File:  [CSRG BSD Unix] / 43BSD / contrib / icon / port / pret3.icn
Revision 1.1: download - view: text, annotated - select for diffs
Tue Apr 24 16:12:55 2018 UTC (8 years, 1 month ago) by root
CVS tags: MAIN, HEAD
Initial revision

#  This program tests lib/pret.s.

procedure main()
   i := 0
   while i < 5 do {
      write(expression())
      i +:= 1
      }
end

procedure expression()
   return case ?3 of {
      1  :  term()
      2  :  term()
      3  :  term() || "+" || expression()
      }
end

procedure term()
   return case ?2 of {
      1  :  element()
      2  :  element() || "*" || term()
      }
end
procedure element()
   return case ?4 of {
      1  :  "x"
      2  :  "y"
      3  :  "z"
      4  :  "(" || expression() || ")"
      }
end

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.