summaryrefslogtreecommitdiff
path: root/test/undofrag2.lm
blob: 66641af0e64b9c32e8b1b30026e8090cff30fcfc (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
context undo

	lex
		ignore /[ \t]+/
		literal '*', '(', ')', '^', ';', '\n'
		token id /[a-zA-Z_]+/
	end

	Out: parser<out>

	def out_item
		[id]
	|	['(' item* ')']

	def out 
		[out_item*]

	def item 
		[id]
		{
			send Out [r1]
		}
	|	['(' item* ')']
		{
			send Out ['(']
			send Out [r2]
			send Out [')']
		}

	def A1 []
	def A2 []


	def start 
		[A1 item* '^']
	|	[A2 item* ';' '\n']

end undo

cons Undo: undo[]
Undo.Out = construct parser<undo::out> []

parse InputP: undo::start(Undo)[ stdin ]
Input: undo::start = InputP.tree
print( Input )