You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
476 B
32 lines
476 B
grammar t016actions;
|
|
options {
|
|
language = Python;
|
|
}
|
|
|
|
declaration returns [name]
|
|
: functionHeader ';'
|
|
{$name = $functionHeader.name}
|
|
;
|
|
|
|
functionHeader returns [name]
|
|
: type ID
|
|
{$name = $ID.text}
|
|
;
|
|
|
|
type
|
|
: 'int'
|
|
| 'char'
|
|
| 'void'
|
|
;
|
|
|
|
ID : ('a'..'z'|'A'..'Z'|'_') ('a'..'z'|'A'..'Z'|'0'..'9'|'_')*
|
|
;
|
|
|
|
WS : ( ' '
|
|
| '\t'
|
|
| '\r'
|
|
| '\n'
|
|
)+
|
|
{$channel=HIDDEN}
|
|
;
|