-
Notifications
You must be signed in to change notification settings - Fork 0
/
context-free-grammar.txt
38 lines (30 loc) · 1.47 KB
/
context-free-grammar.txt
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
<program> --> <form>*
<form> --> <definition> | <expression>
<definition> --> <variable definition>
<variable definition> --> (define <variable> <expression>)
| (define <variable> read)
| (define (<variable> <variable>*) <body>)
<expression> --> <constant>
| <variable>
| (lambda <formals> <body>)
| (list <expression>*)
| (if <expression> <expression> <expression>)
| <application>
| (let ([<identifier> <expression>]+) <expression>+)
| (write <expression>)
<constant> --> <boolean>
| <number>
| <character>
| <string>
<formals> --> <variable> | (<variable>*)
<variable> --> <identifier>
<body> --> <definition>* <expression>+
<application> --> (<expression> <expression>*)
<identifier> --> <letter> <subsequent>* | + | - | ...
<subsequent> --> <letter> | <digit> | . | + | -
<letter> --> a | b | ... | z
<digit> --> 0 | 1 | ... | 9
<boolean> --> #t | #f
<number> --> <digit>+
<character> --> '<letter>'
<string> --> "<letter>*"