summaryrefslogtreecommitdiff
path: root/test/treecmp1.lm
blob: 178f10d717b9fa7163effa918c65e5e1af24bdc5 (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
##### LM #####
rl ident_pattern /[a-zA-Z_][a-zA-Z_0-9]*/
rl number_pattern /[0-9]+/

lex
	ignore /[ \t\n]+/
	token id /ident_pattern/
	token number /number_pattern/
end

def four_ids
	[id id id id]

B: id = construct id "b"

parse InputP: four_ids[ stdin ]
Input: four_ids = InputP.tree

for Id: id in Input {
	if ( Id == B )
		print( B '\n' )
}
##### IN #####
a b c d
##### EXP #####
b