blob: 57b8659d4e41bb5aefa3238453981ed92986ce21 (
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
44
45
46
47
48
49
50
51
52
|
namespace fail
lex
ignore /space+/
literal `# `{ `} `!
token id /[a-zA-Z_]+/
end
def item
[id]
| [`{ item* `}]
def start
[item* `!]
end
lex
ignore /space+/
literal `# `{ `}
token id /[a-zA-Z_]+/
end
def item
[id]
| [`{ item* `}]
def start
[fail::start]
| [item*]
new P: parser<start>()
O1: stream = open( "streamseq1a.in", "r" )
O2: stream = open( "streamseq1b.in", "r" )
O3: stream = open( "streamseq1c.in", "r" )
if O1 && O2 && O3 {
send P [O1]
send P [O2]
send P [O3]
}
else {
print "could not open input files
}
send P [] eos
print [ P->tree ]
##### EXP #####
a b c { d } e f g
h i j { k } l m n
o p q { r } s t u
|