Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function_declare returns [ASTNode node]:
- FUNCTION name=ID {
- List<String> paramIds = new ArrayList<>();
- List<ASTNode> body = new ArrayList<>();
- } PAR_OPEN ( id0=ID {
- paramIds.add($id0.text);
- } (COMMA id1=ID {
- paramIds.add($id1.text);
- } )* )? PAR_CLOSE BRACKET_OPEN ( sentence {
- body.add($sentence.node);
- } )*
- BRACKET_CLOSE{
- $node = new FunctionDeclare( $name.text , paramIds , body );
- };
- function_ref returns [ASTNode node]:
- ID {
- List<ASTNode> params = new ArrayList<>();
- }
- PAR_OPEN ( e0=expression {
- params.add($e0.node);
- }(COMMA e1=expression {
- params.add($e1.node);
- })* )? PAR_CLOSE{
- $node = new FunctionRef( $ID.text , params );
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement