TT3: /home/abw/web/london/tt3/slides/examples/expressions.tt3
Source
Tokens
Tree
Variables
Output
Template Source
%%
name
or
'World'
%%
foo
or
(
bar
and
baz
<
wam
or
bam
)
%%
a
+
b
*
c
/
d
*
(
e
+
f
/
(
g
+
d
)
)
--EOF--
Source Tokens
tag_start
@0
%%
whitespace
@2
variable
@3
name
whitespace
@7
binary operator
@8
or
whitespace
@10
squote string
@11
'World'
tag_end
@18
\n\n
tag_start
@20
%%
whitespace
@22
variable
@23
foo
whitespace
@26
binary operator
@27
or
whitespace
@29
construct parens
@30
(
variable
@31
bar
whitespace
@34
binary operator
@35
and
whitespace
@38
variable
@39
baz
whitespace
@42
number lessthan
@43
<
whitespace
@44
variable
@45
wam
whitespace
@48
binary operator
@49
or
whitespace
@51
variable
@52
bam
terminator
@55
)
tag_end
@56
\n\n
tag_start
@58
%%
whitespace
@60
variable
@61
a
whitespace
@62
number add
@63
+
whitespace
@64
variable
@65
b
whitespace
@66
number multiply
@67
*
whitespace
@68
variable
@69
c
whitespace
@70
number divide
@71
/
whitespace
@72
variable
@73
d
whitespace
@74
number multiply
@75
*
whitespace
@76
construct parens
@77
(
variable
@78
e
whitespace
@79
number add
@80
+
whitespace
@81
variable
@82
f
whitespace
@83
number divide
@84
/
whitespace
@85
construct parens
@86
(
variable
@87
g
whitespace
@88
number add
@89
+
whitespace
@90
variable
@91
d
terminator
@92
)
terminator
@93
)
eof
@94
Parse Tree
binary expr
@8
name or 'World'
variable element
@3
name
or
squote string element
@11
'World'
binary expr
@27
foo or ( bar and baz < wam or bam )
variable element
@23
foo
or
parens expr
@30
( bar and baz < wam or bam )
(
binary expr
@49
bar and baz < wam or bam
binary expr
@35
bar and baz < wam
variable element
@31
bar
and
binary expr
@43
baz < wam
variable element
@39
baz
<
variable element
@45
wam
or
variable element
@52
bam
)
binary expr
@63
a + b * c / d * ( e + f / ( g + d ) )
variable element
@61
a
+
binary expr
@75
b * c / d * ( e + f / ( g + d ) )
binary expr
@71
b * c / d
binary expr
@67
b * c
variable element
@65
b
*
variable element
@69
c
/
variable element
@73
d
*
parens expr
@77
( e + f / ( g + d ) )
(
binary expr
@80
e + f / ( g + d )
variable element
@78
e
+
binary expr
@84
f / ( g + d )
variable element
@82
f
/
parens expr
@86
( g + d )
(
binary expr
@89
g + d
variable element
@87
g
+
variable element
@91
d
)
)
Variables Used
a
Uses
@ line 5
%%
a
+ b * c / d * (e + f / (g + d))
b
Uses
@ line 5
%% a +
b
* c / d * (e + f / (g + d))
bam
Uses
@ line 3
%% foo or (bar and baz < wam or
bam
)
bar
Uses
@ line 3
%% foo or (
bar
and baz < wam or bam)
baz
Uses
@ line 3
%% foo or (bar and
baz
< wam or bam)
c
Uses
@ line 5
%% a + b *
c
/ d * (e + f / (g + d))
d
Uses
@ line 5
%% a + b * c /
d
* (e + f / (g + d))
@ line 5
%% a + b * c / d * (e + f / (g +
d
))
e
Uses
@ line 5
%% a + b * c / d * (
e
+ f / (g + d))
f
Uses
@ line 5
%% a + b * c / d * (e +
f
/ (g + d))
foo
Uses
@ line 3
%%
foo
or (bar and baz < wam or bam)
g
Uses
@ line 5
%% a + b * c / d * (e + f / (
g
+ d))
name
Uses
@ line 1
%%
name
or 'World'
wam
Uses
@ line 3
%% foo or (bar and baz <
wam
or bam)
Generated Output
TT3 undefined data error at line 3 of /home/abw/web/london/tt3/slides/examples/expressions.tt3:
Error:
Undefined value returned by expression: bar
Source:
%% foo or (bar and baz < wam or bam)
^ here