summaryrefslogtreecommitdiff
path: root/test/colm.d/translate1.lm
blob: 48438d5a8159560cf64f6577f67b921d34c7b7cc (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
lex
	ignore /space+/
	literal `* `( `)
	token id /[a-zA-Z_]+/ 
		{
			t: str = input->pull( match_length )
			input->push( make_token( typeid<id>, t ) )
		}
end

def foo [id]

def item 
	[id]
|	[foo]
|	[`( item* `)]

def start 
	[item*]

parse Input: start[ stdin ]
print[ @Input ]

##### IN #####
a b ( c d ) e f
##### EXP #####
a b ( c d ) e f