home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / OL.LZH / PROGS.LZH / INTERPE.ICN < prev    next >
Text File  |  1991-09-05  |  1KB  |  42 lines

  1. ############################################################################
  2. #
  3. #    Name:    interpe.icn
  4. #
  5. #    Title:    Interpret Icon expressions
  6. #
  7. #    Author:    Ralph E. Griswold
  8. #
  9. #    Date:    September 2, 1991
  10. #
  11. ############################################################################
  12. #
  13. #    This program is a crude but effective interpreter for Icon expressions.
  14. #  Each line entered from standard input is presumed to be an Icon
  15. #  expression, is wrapped with a main procedure, and written to a pipe
  16. #  that compiles and executes the resulting program.
  17. #
  18. #    This technique is, of course, inefficient and may be painfully
  19. #  slow except on the fastest platforms. This technique is, however,
  20. #  completely general and as correct as Icon itself.
  21. #
  22. #    Note:  This programs creates files with the names stdin, stdin.u1,
  23. #  and stdin.u2. It removes them before terminating, but, of course,
  24. #  overwrites any pre-existing files by these names.
  25. #
  26. ############################################################################
  27. #
  28. #  Requires: UNIX
  29. #
  30. #  See also:  interpp.icn
  31. #
  32. ############################################################################
  33.  
  34. procedure main()
  35.    repeat {
  36.       run := open("icont -s - -x","pw")
  37.       write(run,"procedure main();every write(image(",read(),"));end") | break
  38.       close(run)
  39.       }
  40.    system("rm -f stdin stdin.u1 stdin.u2")
  41. end
  42.