blob: a4eaaf52e5ad1ebeb4f1c6eef997cab29a5a251d (
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
|
##### LM #####
lex
literal '{', '}'
literal 'struct', 'type'
token id /[A-Za-z_][A-Za-z_0-9]*/
ignore /[ \t\r\n]+/
end
def attribute
['type' id]
def struct
['struct' id '{' attribute* '}']
def program
[struct*]
int func( P: program )
{
print( P '\n' )
}
int main()
{
parse PP: program[ stdin ]
P: program = PP.tree
func( P )
}
main()
##### IN #####
struct S
{
type T
}
##### EXP #####
struct S
{
type T
}
|