Skip to content
sadache edited this page Sep 14, 2010 · 5 revisions

compile "if year=2000 then 1 + \ooo/ 1.2 * 1 + &RENT else 2 "

produces

If (BinaryExp (ComparaOp Equals,Context Year,Const 2000.0), BinaryExp (DoubleOp Plus,Const 1.0, Children (Sum, BinaryExp (DoubleOp Plus,BinaryExp (DoubleOp Times,Const 1.2,Const 1.0), Ref ("RENT",<fun:_fsyacc_reductions@54-352>)))),Const 2.0)

U can use parentheses:

let exp2 = compile "if year=2000 then 1 + (\ooo/ 1.2) * 1 + &RENT else 2 "
produces
If (BinaryExp (ComparaOp Equals,Context Year,Const 2000.0), BinaryExp (DoubleOp Plus, BinaryExp (DoubleOp Plus,Const 1.0, BinaryExp (DoubleOp Times,Children (Sum,Const 1.2),Const 1.0)), Ref ("RENT",<fun:_fsyacc_reductions@54-352>)),Const 2.0)

just added support for something like:

compile "if year=2000 then 1 + \ooo/ 1.2 * 1 + previousMonth:&RENT else 2 "

compile "if year=2000 then 1 + \ooo/ 1.2 * 1 + previousYear:&RENT else 2 "

Clone this wiki locally