summaryrefslogtreecommitdiff
path: root/ipl/progs/evaluate.icn
blob: 0137e9f7cbec915e754818b96344b565e3dd21e2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
############################################################################
#
#	File:     evaluate.icn
#
#	Subject:  Program to evaluate Icon expressions
#
#	Author:   Ralph E. Griswold
#
#	Date:     March 4, 1995
#
############################################################################
#
#   This file is in the public domain.
#
############################################################################
#
#  This program evaluates Icon operations given from standard input in
#  functional form.  It cannot handle nested expressions or control
#  structures.  See eval.icn for more details.
#
#  There is one option:
#
#	-l i	limit on number of results from a generator; default 2 ^ 30
#
############################################################################
#
#  Links:  eval, options
#
############################################################################

link eval
link options

procedure main(args)
   local expr, opts, limit

   opts := options(args, "l+")
   limit := \opts["l"] | 2 ^ 30

   while expr := read() do
      every write(eval(expr)) \ limit

end