summaryrefslogtreecommitdiff
path: root/support/splint/examples/types/test.sty
blob: 3158482b1ad6f88c95a5c4b1cd8abfc2093c7277 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
% Copyright 2012-2022, Alexander Shibakov
% This file is part of SPLinT
%
% SPLinT is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% SPLinT is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with SPLinT.  If not, see <http://www.gnu.org/licenses/>.

% some examples of the `tree evaluator' and the `expandable arithmetic' macros

\input ../../tex/yycommon.sty
\input ../../tex/trt1.sty
\input ../../tex/yymisc.sty
\input basic.sty
\input tree.sty

% defining the node arities for the tree evaluator

\nodesetup{xmul}{2}
\nodesetup{xsum}{2}
\nodesetup{xxttop}{0}
\nodesetup{the}{0}
\nodesetup{number}{0}

%\tracingmacros=3
%\tracingonline=3

\tempca=77

\edef\asum{\xsum{0}{21809808}}
\edef\aproduct{\xmul{118768770987098709870987098787979}{69876987698769824320980}}

\message{product: \aproduct, sum: \asum}

\def\anexpression{\treeeval{\xmul{\xsum{\xsum{1}{\xmul{2764567}{74674}}}{3}}{\xsum{\the\tempca}{\xsum{\number\tempcb}{\xmul{5764567}{7}}}}}}

\message{value of the expression: \anexpression}

% `symbolic definitions' of the nodes for the tree evaluator

\def\xsum#1#2{(#1 + #2)}
\def\xmul#1#2{#1 * #2}

\message{expression: \anexpression}

%\tracingmacros=0
%\tracingonline=0

%\tempca=17

%\edef\seq{\noexpand\startconversion\expander{}\sequence\tempca{*}SS\sequence\tempca{.}SS\sequence\tempca{.}SF}
%\show\seq
%\edef\cseq{\seq}
%\show\cseq

\end