|
@ -30,7 +30,7 @@ |
|
|
_DO(PostDecVariable) _DO(PostDecMember) _DO(PostDecIndex) \ |
|
|
_DO(PostDecVariable) _DO(PostDecMember) _DO(PostDecIndex) \ |
|
|
_DO(GetVariable) _DO(GetMember) _DO(SetMember) _DO(GetIndex) _DO(SetIndex) \ |
|
|
_DO(GetVariable) _DO(GetMember) _DO(SetMember) _DO(GetIndex) _DO(SetIndex) \ |
|
|
_DO(Return) _DO(Break) _DO(Continue) _DO(Throw) _DO(Try) \ |
|
|
_DO(Return) _DO(Break) _DO(Continue) _DO(Throw) _DO(Try) \ |
|
|
_DO(Quote) _DO(Append) /* _DO(Quasiquote) _DO(Unquote) */ \ |
|
|
|
|
|
|
|
|
_DO(Quote) /* _DO(Quasiquote) _DO(Unquote) */ \ |
|
|
DO_C_PROTOS() |
|
|
DO_C_PROTOS() |
|
|
|
|
|
|
|
|
#define META_PROTO_MAX t_Try |
|
|
#define META_PROTO_MAX t_Try |
|
@ -1316,7 +1316,7 @@ oop outputProgram= 0; |
|
|
# 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 = m:metaCatch { yylval = m } |
|
|
|
|
|
|
|
|
start = m:metaCatch { yylval= m } |
|
|
| s:externalDeclaration { yylval= s } |
|
|
| s:externalDeclaration { yylval= s } |
|
|
|
|
|
|
|
|
error = EOL* < (!EOL .)* EOL* (!EOL .)* > &{ error(yytext), 1 } |
|
|
error = EOL* < (!EOL .)* EOL* (!EOL .)* > &{ error(yytext), 1 } |
|
@ -1356,7 +1356,7 @@ hexQuad = hexadecimalDigit hexadecimalDigit hexadecimalDigit hex |
|
|
constant = characterConstant |
|
|
constant = characterConstant |
|
|
| floatingConstant |
|
|
| floatingConstant |
|
|
| integerConstant |
|
|
| integerConstant |
|
|
#| META_AT m:meta_exp { $$ = m } |
|
|
|
|
|
|
|
|
| META_AT m:mvalue |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -1453,9 +1453,9 @@ sCharSequence = ( escapeSequence | !EOL [^\"\\] )* #" |
|
|
# 6.5.1 |
|
|
# 6.5.1 |
|
|
|
|
|
|
|
|
primaryExpression = stringLiteral | constant | id |
|
|
primaryExpression = stringLiteral | constant | id |
|
|
| META_AT ( META_LCB x:mstmts |
|
|
|
|
|
| x:mvalue |
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
| META_AT ( META_LCB x:mstmts |
|
|
|
|
|
| x:mvalue |
|
|
|
|
|
) |
|
|
| 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) } |
|
|
|
|
|
|
|
@ -1836,7 +1836,7 @@ typedefName = &{ isTypedefName(yytext) } { $$= new_C_id(yytext) } - |
|
|
|
|
|
|
|
|
initializer = l:LCURLY i:initializerList ( c:COMMA | {c=newNullObject()} ) r:RCURLY { $$= new_C_initializer(l, i, c, r) } |
|
|
initializer = l:LCURLY i:initializerList ( c:COMMA | {c=newNullObject()} ) r:RCURLY { $$= new_C_initializer(l, i, c, r) } |
|
|
| assignmentExpression |
|
|
| assignmentExpression |
|
|
| META_AT m:meta_exp { $$ = m } |
|
|
|
|
|
|
|
|
| META_AT m:mvalue |
|
|
|
|
|
|
|
|
initializerList = { listBegin() } |
|
|
initializerList = { listBegin() } |
|
|
( d:designation { listAppend(d) } |
|
|
( d:designation { listAppend(d) } |
|
@ -1880,7 +1880,6 @@ labeledStatement = i:id c:COLON |
|
|
| d:DEFAULT c:COLON s:statement { $$= new_C_default(d, c, s) } |
|
|
| d:DEFAULT c:COLON s:statement { $$= new_C_default(d, c, s) } |
|
|
|
|
|
|
|
|
# 6.8.2 |
|
|
# 6.8.2 |
|
|
# todo add meta or list meta (@@ for list of things) |
|
|
|
|
|
|
|
|
|
|
|
compoundStatement = @{ C_scopeBegin() } |
|
|
compoundStatement = @{ C_scopeBegin() } |
|
|
l:LCURLY { listBegin() } |
|
|
l:LCURLY { listBegin() } |
|
@ -2165,24 +2164,24 @@ _FLOAT128 = '_Float128' !IDREST &{gnu} { $$= newToken("_Float1 |
|
|
# input buffer from moving past it before redirecting input from the imported file |
|
|
# input buffer from moving past it before redirecting input from the imported file |
|
|
|
|
|
|
|
|
metaCatch = META_AT ( META_IMPORT s:META_STRING ";" { inputStackPush(get(s, String, value)) ; $$ = 0 } |
|
|
metaCatch = META_AT ( META_IMPORT s:META_STRING ";" { inputStackPush(get(s, String, value)) ; $$ = 0 } |
|
|
| m:mvalue { map_append(outputProgram, m) ; $$ = null } |
|
|
|
|
|
| META_LCB m:mstmts { map_append(outputProgram, m) ; $$ = null } |
|
|
|
|
|
|
|
|
| m:mvalue { $$ = m } |
|
|
|
|
|
| META_LCB s:mstmts { map_append(outputProgram, s); $$ = null } |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mvalue = i:META_IDENT { $$ = eval(globals, newGetVariable(i)) } |
|
|
|
|
|
|
|
|
mvalue = i:META_IDENT { $$ = eval(globals, newGetVariable(i)) } |
|
|
| META_LPAREN ( i:MO_OPERATION |
|
|
| META_LPAREN ( i:MO_OPERATION |
|
|
#| i:meta_block usefull ? |
|
|
#| i:meta_block usefull ? |
|
|
| i:meta_exp |
|
|
| i:meta_exp |
|
|
) META_RPAREN { $$ = eval(globals, i) } |
|
|
|
|
|
|
|
|
) META_RPAREN { $$ = eval(globals, i) } |
|
|
|
|
|
|
|
|
mstmts = { listBegin() } ( s:meta_stmt { eval(globals, s) } )* meta_endSTMTS |
|
|
|
|
|
|
|
|
mstmts = ( s:eval_stmt )* ( META_NIL META_SEMICOLON META_RCB { $$ = null } |
|
|
|
|
|
| META_RCB { $$ = s } |
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
meta_endSTMTS = (META_NIL META_SEMICOLON )? META_RCB { listEnd(); $$ = null } |
|
|
|
|
|
| META_DAT META_SEMICOLON META_RCB { $$ = listEnd() } |
|
|
|
|
|
|
|
|
eval_stmt = s:meta_stmt { $$ = eval(globals, s) } |
|
|
|
|
|
|
|
|
meta_stmt = s:meta_block { $$ = s } |
|
|
meta_stmt = s:meta_block { $$ = s } |
|
|
| a:meta_append { $$ = a } |
|
|
|
|
|
| META_SEMICOLON { $$ = null } |
|
|
| META_SEMICOLON { $$ = null } |
|
|
| l:META_IDENT p:meta_paramList e:meta_block { $$ = newFunc(l, p, e, null) } |
|
|
| l:META_IDENT p:meta_paramList e:meta_block { $$ = newFunc(l, p, e, null) } |
|
|
| META_IF META_LPAREN c:meta_exp META_RPAREN t:meta_stmt META_ELSE f:meta_stmt { $$ = newIf(c, t, f ) } |
|
|
| META_IF META_LPAREN c:meta_exp META_RPAREN t:meta_stmt META_ELSE f:meta_stmt { $$ = newIf(c, t, f ) } |
|
@ -2200,8 +2199,6 @@ meta_stmt = s:meta_block |
|
|
| t:meta_try { $$ = t } |
|
|
| t:meta_try { $$ = t } |
|
|
| e:meta_exp META_SEMICOLON { $$ = e } |
|
|
| e:meta_exp META_SEMICOLON { $$ = e } |
|
|
|
|
|
|
|
|
meta_append = META_DAT META_DOT META_APPEND META_LPAREN s:meta_exp META_RPAREN META_SEMICOLON { $$ = newUnary(Append_proto, s) } |
|
|
|
|
|
|
|
|
|
|
|
meta_block = META_LCB m:meta_makeMap |
|
|
meta_block = META_LCB m:meta_makeMap |
|
|
( s:meta_stmt { map_append(m, s) } |
|
|
( s:meta_stmt { map_append(m, s) } |
|
|
) * |
|
|
) * |
|
@ -2405,7 +2402,7 @@ MO_OPERATION = META_BACKTICK ( MO_INITIALIZER i:initializer { $$ = newU |
|
|
| MO_STATEMENT c:statement { $$ = newUnary(Quote_proto ,c) } |
|
|
| MO_STATEMENT c:statement { $$ = newUnary(Quote_proto ,c) } |
|
|
| MO_INTEGER i:integerConstant { $$ = newUnary(Quote_proto ,i) } |
|
|
| MO_INTEGER i:integerConstant { $$ = newUnary(Quote_proto ,i) } |
|
|
| MO_DECLARATION i:declaration { $$ = newUnary(Quote_proto ,i) } |
|
|
| MO_DECLARATION i:declaration { $$ = newUnary(Quote_proto ,i) } |
|
|
| MO_STRING i:stringLiteral { $$ = newUnary(Quote_proto ,i) } |
|
|
|
|
|
|
|
|
| MO_STRING i:stringLiteral { $$ = newUnary(Quote_proto ,i) } |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
# META_OPERATORS = MO_INITIALIZER | MO_CONSTANT | MO_STATEMENT | MO_INTEGER | MO_DECLARATION | MO_STRING |
|
|
# META_OPERATORS = MO_INITIALIZER | MO_CONSTANT | MO_STATEMENT | MO_INTEGER | MO_DECLARATION | MO_STRING |
|
@ -2415,18 +2412,12 @@ MO_CONSTANT = 'constant' ![(a-zA-Z0-9_] -- |
|
|
MO_STATEMENT = 'statement' ![(a-zA-Z0-9_] -- |
|
|
MO_STATEMENT = 'statement' ![(a-zA-Z0-9_] -- |
|
|
MO_INTEGER = 'integer' ![(a-zA-Z0-9_] -- |
|
|
MO_INTEGER = 'integer' ![(a-zA-Z0-9_] -- |
|
|
MO_DECLARATION = 'declaration' ![(a-zA-Z0-9_] -- |
|
|
MO_DECLARATION = 'declaration' ![(a-zA-Z0-9_] -- |
|
|
MO_STRING = 'string' ![(a-zA-Z0-9_] -- |
|
|
|
|
|
|
|
|
MO_STRING = 'string' ![(a-zA-Z0-9_] -- |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
############################ |
|
|
############################ |
|
|
|
|
|
|
|
|
META_NIL = 'nil' ![a-zA-Z0-9_] -- |
|
|
META_NIL = 'nil' ![a-zA-Z0-9_] -- |
|
|
META_FUNCMAP = 'map' ![a-zA-Z0-9_] -- |
|
|
|
|
|
META_FUNCSELECT = 'select' ![a-zA-Z0-9_] -- |
|
|
|
|
|
META_FUNCREJECT = 'reject' ![a-zA-Z0-9_] -- |
|
|
|
|
|
META_DAT = '@@' ![a-zA-Z0-9_] -- |
|
|
|
|
|
META_APPEND = 'append' ![a-zA-Z0-9_] -- |
|
|
|
|
|
|
|
|
|
|
|
#META_FUN = 'fun' ![a-zA-Z0-9_] -- |
|
|
#META_FUN = 'fun' ![a-zA-Z0-9_] -- |
|
|
#META_SYNTAX = 'syntax' ![a-zA-Z0-9_] -- |
|
|
#META_SYNTAX = 'syntax' ![a-zA-Z0-9_] -- |
|
|
META_VAR = 'var' ![a-zA-Z0-9_] -- |
|
|
META_VAR = 'var' ![a-zA-Z0-9_] -- |
|
@ -2891,11 +2882,6 @@ oop eval(oop scope, oop ast) |
|
|
oop obj = map_get(ast, rhs_symbol); |
|
|
oop obj = map_get(ast, rhs_symbol); |
|
|
return obj; |
|
|
return obj; |
|
|
} |
|
|
} |
|
|
case t_Append: { |
|
|
|
|
|
oop obj = eval(scope, map_get(ast, rhs_symbol)); |
|
|
|
|
|
listAppend(obj); |
|
|
|
|
|
return null; |
|
|
|
|
|
} |
|
|
|
|
|
#if 0 |
|
|
#if 0 |
|
|
case t_Quasiquote: { |
|
|
case t_Quasiquote: { |
|
|
oop obj = map_get(ast, rhs_symbol); |
|
|
oop obj = map_get(ast, rhs_symbol); |
|
|