-
Notifications
You must be signed in to change notification settings - Fork 0
/
syntax5
93 lines (66 loc) · 2.01 KB
/
syntax5
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
Jam Syntax
==========
Draft: 2/23/95
<defn> := <id> = <expr>
| <id> ( <formals> ) = <expr>
| <id> ( <formals> ) : <id>
<defns> := epsilon
| <defn> { ; <defn> }*
<formals> := epsilon
| <id> { , <id> }*
<inits> := epsilon
| <id> = <expr> { , <id> = <expr> }*
<args> := epsilon
| <expr> { , <expr> }*
<seq> := epsilon
| <expr> { ; <expr> }*
<lval> := <id>
| <id> [ <args> ]
<expr> := <constant>
| <id>
| <id> ( <args> )
| <id> [ <args> ]
| <prim>
| <prim> ( <args> )
| if <expr> then <expr> { elseif <expr> then <expr> }*
( { else <expr> } | { elsefalse } ) !! else false
| let <defns> in <expr>
| inorder <seq> return <expr> !! optional return
| set <lval> to <expr>
| do <id> ( <inits> ) = <expr> !! call, not do (imp)
| <uop> <expr>
| <expr> <bop> <expr>
| [ <args> { ; <args> }* ]
| ( <expr> )
<uop> := - | +
<bop> := + | - | * | / | ^ | = | <= | >= | =/= | < | > !! = vs ==
<prim> := tuple? | tabulate | size(?)
| array? | array | size(?)
| symbol?
| number? | zero? | positive? | odd? | sqrt | log
| sin | cos | tan | atan
| and | or | not | xor | nand | nor
? | list? | null? | pair? | cons | list | car | cdr
| function?
| equal?
<constant> := true | false
| <symbol>
| <string>
| <number>
| empty
<symbol> := ` <char>* '
<string> := " <char>* "
<char> := <charset> \ { \ , ' , " }
| \\ | \' | \" | \n | \t
<number> := <real> !! <int>
| <imag>
<imag> := <real> i
<real> := <sign> <ureal>
<sign> := epsilon | + | -
<ureal> := <digit>+ <suffix>
| . <digit>+ <suffix>
| <digit>+ . <digit>* <suffix>
<suffix> := epsilon
| e <sign> <digit>+
<digit> := 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9
where <charset> is currently left unspecified. !! ditto for <id>