home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / historic / v941.tgz / icon.v941src.tar / icon.v941src / ipl / progs / evaluate.icn < prev    next >
Text File  |  2000-07-29  |  1KB  |  44 lines

  1. ############################################################################
  2. #
  3. #    File:     evaluate.icn
  4. #
  5. #    Subject:  Program to evaluate Icon expressions
  6. #
  7. #    Author:   Ralph E. Griswold
  8. #
  9. #    Date:     March 4, 1995
  10. #
  11. ############################################################################
  12. #
  13. #   This file is in the public domain.
  14. #
  15. ############################################################################
  16. #
  17. #  This program evaluates Icon operations given from standard input in
  18. #  functional form.  It cannot handle nested expressions or control
  19. #  structures.  See eval.icn for more details.
  20. #
  21. #  There is one option:
  22. #
  23. #    -l i    limit on number of results from a generator; default 2 ^ 30
  24. #
  25. ############################################################################
  26. #
  27. #  Links:  eval, options
  28. #
  29. ############################################################################
  30.  
  31. link eval
  32. link options
  33.  
  34. procedure main(args)
  35.    local expr, opts, limit
  36.  
  37.    opts := options(args, "l+")
  38.    limit := \opts["l"] | 2 ^ 30
  39.  
  40.    while expr := read() do
  41.       every write(eval(expr)) \ limit
  42.  
  43. end
  44.