|
|
1.1 ! root 1: # This program tests lib/pret.s. ! 2: ! 3: procedure main() ! 4: i := 0 ! 5: while i < 5 do { ! 6: write(expression()) ! 7: i +:= 1 ! 8: } ! 9: end ! 10: ! 11: procedure expression() ! 12: return case ?3 of { ! 13: 1 : term() ! 14: 2 : term() ! 15: 3 : term() || "+" || expression() ! 16: } ! 17: end ! 18: ! 19: procedure term() ! 20: return case ?2 of { ! 21: 1 : element() ! 22: 2 : element() || "*" || term() ! 23: } ! 24: end ! 25: procedure element() ! 26: return case ?4 of { ! 27: 1 : "x" ! 28: 2 : "y" ! 29: 3 : "z" ! 30: 4 : "(" || expression() || ")" ! 31: } ! 32: end
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.