blob: 52f6f3c598843ad40c35d6e4ca5dcac1859fa3b9 (
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
|
lex start
{
literal '{', '}'
literal 'struct', 'type'
token id /[A-Za-z_][A-Za-z_0-9]*/
ignore /'/*' any* :>> '*/'/
ignore /[ \t\r\n]+/
}
def attribute
['type' id]
def struct
['struct' id '{' attribute* '}']
def program
[struct*]
int func( P: program )
{
}
int main()
{
InputFile: stream = open( 'func.in' "r" )
P: program = parse program( InputFile )
func( P )
print( P )
}
main()
|