more nodes
git-svn-id: svn://anubis/jtlc/trunk@15 f5bc74b8-7b62-4e90-9214-7121d538519f
This commit is contained in:
1 parent
7b1893c1e5
commit
9c26b9593c
3 files changed
+39
-8
No files matched your search
+23
-7
@@ -93,6 +93,7 @@ static YYSTYPE parse_result;
|
||||
program: program_items {
|
||||
$$ = new ProgramNode();
|
||||
$$->addChildren($1);
|
||||
parse_result = $$;
|
||||
}
|
||||
;
|
||||
|
||||
@@ -241,24 +242,39 @@ type: primitive_type {
|
||||
}
|
||||
;
|
||||
|
||||
statement: expression SEMICOLON
|
||||
| return_statement
|
||||
statement: expression SEMICOLON {
|
||||
$$ = $1;
|
||||
}
|
||||
| return_statement {
|
||||
$$ = $1;
|
||||
}
|
||||
| c_statement {
|
||||
$$ = $1;
|
||||
}
|
||||
;
|
||||
|
||||
return_statement: RETURN expression SEMICOLON
|
||||
return_statement: RETURN expression SEMICOLON {
|
||||
$$ = new ReturnStatementNode();
|
||||
$$->addChild($2);
|
||||
}
|
||||
;
|
||||
|
||||
expression: assign_expr
|
||||
expression: assign_expr {
|
||||
$$ = $1;
|
||||
}
|
||||
;
|
||||
|
||||
assign_expr: lvalue ASSIGN expression
|
||||
| lvalue DASSIGN expression
|
||||
assign_expr: lvalue ASSIGN expression {
|
||||
$$ = new AssignExprNode();
|
||||
$$->addChild($1);
|
||||
$$->addChild($3);
|
||||
}
|
||||
;
|
||||
|
||||
lvalue: IDENTIFIER
|
||||
lvalue: IDENTIFIER {
|
||||
$$ = new LValueNode();
|
||||
$$->addChild($1);
|
||||
}
|
||||
;
|
||||
|
||||
c_statement: C LPAREN STRING_LITERAL RPAREN SEMICOLON {
|
||||
|
||||
Reference in new issue
Block a user