blob: f79b21a49de4af289bebed6b5b783a5bfc869a3a (
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
|
##### 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 )
}
int main()
{
parse P: program[ stdin ]
func( P )
}
main()
##### IN #####
struct S
{
type T
}
##### EXP #####
struct S
{
type T
}
|