|
@ -1264,11 +1264,15 @@ language lang = C, printLang = C; |
|
|
# yylval == null => "pseudo" op, e.g., change language -- ignored by REPL |
|
|
# yylval == null => "pseudo" op, e.g., change language -- ignored by REPL |
|
|
# yylval == 0 => end of input file while in META mode only |
|
|
# yylval == 0 => end of input file while in META mode only |
|
|
|
|
|
|
|
|
start = META_AT META_LPAREN s:meta_exp META_RPAREN { yylval= s } |
|
|
|
|
|
| META_AT META_LCB { yylval= null; lang= META } |
|
|
|
|
|
| &{ lang == META } - s:meta { yylval= s } |
|
|
|
|
|
| &{ lang == META } - META_RCB { yylval= null; lang= C } |
|
|
|
|
|
| &{ lang == C } s:externalDeclaration { yylval= s } |
|
|
|
|
|
|
|
|
start = m:mexp { yylval= m } |
|
|
|
|
|
| META_AT META_LCB { yylval= null; lang= META } |
|
|
|
|
|
| &{ lang == META } - s:meta { yylval= s } |
|
|
|
|
|
| &{ lang == META } - META_RCB { yylval= null; lang= C } |
|
|
|
|
|
| &{ lang == C } s:externalDeclaration { yylval= s } |
|
|
|
|
|
|
|
|
|
|
|
mexp = META_AT META_LPAREN ( @{ lang = META } s:meta_exp META_RPAREN @{ lang = C } { $$= s } |
|
|
|
|
|
| @{ lang = C } &{ 0 } |
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
error = EOL* < (!EOL .)* EOL* (!EOL .)* > &{ error(yytext), 1 } |
|
|
error = EOL* < (!EOL .)* EOL* (!EOL .)* > &{ error(yytext), 1 } |
|
|
|
|
|
|
|
@ -1401,6 +1405,7 @@ sCharSequence = ( escapeSequence | !EOL [^\"\\] )* |
|
|
# 6.5.1 |
|
|
# 6.5.1 |
|
|
|
|
|
|
|
|
primaryExpression = stringLiteral | constant | id |
|
|
primaryExpression = stringLiteral | constant | id |
|
|
|
|
|
| x:mexp { $$ = eval(globals, x) } |
|
|
| l:LPAREN x:expression r:RPAREN { $$= new_C_subexpr(l, x, r) } |
|
|
| l:LPAREN x:expression r:RPAREN { $$= new_C_subexpr(l, x, r) } |
|
|
| l:LPAREN x:compoundStatement r:RPAREN &{gnu} { $$= new_C_subexpr(l, x, r) } |
|
|
| l:LPAREN x:compoundStatement r:RPAREN &{gnu} { $$= new_C_subexpr(l, x, r) } |
|
|
|
|
|
|
|
@ -1866,12 +1871,12 @@ jumpStatement = g:GOTO i:id t:SEMI { $$= new_C_goto(g, newNullObject(), i |
|
|
|
|
|
|
|
|
## translationUnit = externalDeclaration+ |
|
|
## translationUnit = externalDeclaration+ |
|
|
|
|
|
|
|
|
externalDeclaration = <Space+> { yylval = newComment(yytext); } |
|
|
|
|
|
|
|
|
externalDeclaration = <Space+> { $$ = newComment(yytext); } |
|
|
| ( SEMI &{gnu} |
|
|
| ( SEMI &{gnu} |
|
|
| declaration |
|
|
| declaration |
|
|
| functionDefinition |
|
|
| functionDefinition |
|
|
| &. &{ errmsg= "declaration expected" } error |
|
|
| &. &{ errmsg= "declaration expected" } error |
|
|
) { yylval= $$; } |
|
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
functionDefinition = @{ C_declarationBegin() } |
|
|
functionDefinition = @{ C_declarationBegin() } |
|
|
( s:functionDeclarationSpecifiers | &{gnu} {s=newNullObject()} ) |
|
|
( s:functionDeclarationSpecifiers | &{gnu} {s=newNullObject()} ) |
|
@ -4519,7 +4524,7 @@ int main(int argc, char **argv) |
|
|
map_set(globals, intern("clone" ), makeFunction(prim_clone, intern("clone" ), null, null, globals, null)); |
|
|
map_set(globals, intern("clone" ), makeFunction(prim_clone, intern("clone" ), null, null, globals, null)); |
|
|
map_set(globals, intern("import" ), makeFunction(prim_import, intern("import" ), null, null, globals, null)); |
|
|
map_set(globals, intern("import" ), makeFunction(prim_import, intern("import" ), null, null, globals, null)); |
|
|
map_set(globals, intern("microseconds"), makeFunction(prim_microseconds, intern("microseconds"), null, null, globals, null)); |
|
|
map_set(globals, intern("microseconds"), makeFunction(prim_microseconds, intern("microseconds"), null, null, globals, null)); |
|
|
map_set(globals, intern("String" ), makeFunction(prim_String , intern("String" ), null, null, globals, null)); |
|
|
|
|
|
|
|
|
map_set(globals, intern("string" ), makeFunction(prim_String , intern("string" ), null, null, globals, null)); |
|
|
|
|
|
|
|
|
map_set(globals, intern("scope"), makeFunction(prim_scope, intern("scope"), null, null, globals, null)); |
|
|
map_set(globals, intern("scope"), makeFunction(prim_scope, intern("scope"), null, null, globals, null)); |
|
|
|
|
|
|
|
|