open Ast open Parser EXTEND term: LEVEL "add" [ [ t1 = term; SYMBOL "+"; t2 = term -> return_term loc (Appl [Ident ("plus", []); t1; t2]) | t1 = term; SYMBOL "-"; t2 = term -> return_term loc (Appl [Ident ("minus", []); t1; t2]) ] ]; term: LEVEL "mult" [ [ t1 = term; SYMBOL "*"; t2 = term -> return_term loc (Appl [Ident ("times", []); t1; t2]) | t1 = term; SYMBOL "/"; t2 = term -> return_term loc (Appl [Ident ("div", []); t1; t2]) ] ]; term: LEVEL "inv" [ [ SYMBOL "-"; t = term -> return_term loc (Appl [Ident ("uminus", []); t]) ] ]; END