| 1 |
DSL EXPRESSION: |
| 2 |
$sum = float(0); |
| 3 |
for(k,v in $*) { |
| 4 |
if (k =~ "^[xy]$") { |
| 5 |
$sum += float($[k]) |
| 6 |
} |
| 7 |
} |
| 8 |
|
| 9 |
|
| 10 |
AST: |
| 11 |
"block" [tt:block] [nt:StatementBlock] |
| 12 |
"=" [tt:equals] [nt:Assignment] |
| 13 |
"$sum" [tt:field_name] [nt:DirectFieldValue] |
| 14 |
"float" [tt:kw_float] [nt:FunctionCallsite] |
| 15 |
"0" [tt:int_literal] [nt:int_literal] |
| 16 |
"for" [tt:kw_for] [nt:ForLoopTwoVariable] |
| 17 |
"k" [tt:non_sigil_name] [nt:LocalVariable] |
| 18 |
"v" [tt:non_sigil_name] [nt:LocalVariable] |
| 19 |
"$*" [tt:full_srec] [nt:FullSrec] |
| 20 |
"block" [tt:block] [nt:StatementBlockInBraces] |
| 21 |
"block" [tt:block] [nt:StatementBlock] |
| 22 |
"if_chain" [tt:if_chain] [nt:IfChain] |
| 23 |
"if" [tt:kw_if] [nt:IfItem] |
| 24 |
"=~" [tt:op_eqtilde] [nt:Operator] |
| 25 |
"k" [tt:non_sigil_name] [nt:LocalVariable] |
| 26 |
""^[xy]$"" [tt:string_literal] [nt:string_literal] |
| 27 |
"block" [tt:block] [nt:StatementBlockInBraces] |
| 28 |
"block" [tt:block] [nt:StatementBlock] |
| 29 |
"+=" [tt:op_plus_equals] [nt:CompoundAssignment] |
| 30 |
"$sum" [tt:field_name] [nt:DirectFieldValue] |
| 31 |
"+=" [tt:op_plus_equals] [nt:op_plus_equals] |
| 32 |
"float" [tt:kw_float] [nt:FunctionCallsite] |
| 33 |
"$[]" [tt:$[]] [nt:IndirectFieldValue] |
| 34 |
"k" [tt:non_sigil_name] [nt:LocalVariable] |
| 35 |
|
| 36 |
a=pan,b=pan,i=1,x=0.34679014,y=0.72680286,sum=1.07359301 |
| 37 |
a=eks,b=pan,i=2,x=0.75867996,y=0.52215111,sum=1.28083107 |
| 38 |
a=wye,b=wye,i=3,x=0.20460331,y=0.33831853,sum=0.54292183 |
| 39 |
a=eks,b=wye,i=4,x=0.38139939,y=0.13418874,sum=0.51558814 |
| 40 |
a=wye,b=pan,i=5,x=0.57328892,y=0.86362447,sum=1.43691339 |
| 41 |
a=zee,b=pan,i=6,x=0.52712616,y=0.49322129,sum=1.02034745 |
| 42 |
a=eks,b=zee,i=7,x=0.61178406,y=0.18788492,sum=0.79966898 |
| 43 |
a=zee,b=wye,i=8,x=0.59855401,y=0.97618139,sum=1.57473539 |
| 44 |
a=hat,b=wye,i=9,x=0.03144188,y=0.74955076,sum=0.78099264 |
| 45 |
a=pan,b=wye,i=10,x=0.50262601,y=0.95261836,sum=1.45524437 |