blob: 06430d7bd37f3da08bcea47e39f0c2b76d892aaf (
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
|
lex start
{
ignore /[ \t]+/
literal '*', '(', ')', '^', ';', '\n'
token id /[a-zA-Z_]+/
}
global Out: parser<out> = construct parser<out> []
def out_item
[id]
| ['(' item* ')']
def out
[out_item*]
def item
[id]
{
Out << r1
}
| ['(' item* ')']
{
Out << '('
Out << r2
Out << ')'
}
def A1 []
def A2 []
def start
[A1 item* '^']
| [A2 item* ';' '\n']
Input: start = parse start( stdin )
print( Input )
|