|
@ -2101,19 +2101,6 @@ __INLINE = '__inline' !IDREST &{gnu} { $$= newToken("__inlin |
|
|
_FLOAT128 = '_Float128' !IDREST &{gnu} { $$= newToken("_Float128" ) } - |
|
|
_FLOAT128 = '_Float128' !IDREST &{gnu} { $$= newToken("_Float128" ) } - |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#--------------------------------------------- Common rules ----------------------------------------------# |
|
|
|
|
|
|
|
|
|
|
|
- = (blank | comment)* |
|
|
|
|
|
|
|
|
|
|
|
blank = space | eol |
|
|
|
|
|
space = [ \t] |
|
|
|
|
|
eol = ( "\n""\r"* |
|
|
|
|
|
| "\r""\n"* |
|
|
|
|
|
) { inputStack->lineNumber++ } |
|
|
|
|
|
|
|
|
|
|
|
comment = "//" ( ![\n\r] . )* |
|
|
|
|
|
| "/*" ( !"*/" (eol | .) )* "*/" |
|
|
|
|
|
|
|
|
|
|
|
#--------------------------------------------- Meta grammar ----------------------------------------------# |
|
|
#--------------------------------------------- Meta grammar ----------------------------------------------# |
|
|
|
|
|
|
|
|
# the semicolon has to be explicit with no space eaten afterwards to prevent the |
|
|
# the semicolon has to be explicit with no space eaten afterwards to prevent the |
|
@ -3432,7 +3419,8 @@ void readEvalPrint(oop scope, char *fileName) |
|
|
proto_t proto_number = get(map_get(proto, __name___symbol), Symbol, prototype); |
|
|
proto_t proto_number = get(map_get(proto, __name___symbol), Symbol, prototype); |
|
|
if (proto_number > META_PROTO_MAX) { |
|
|
if (proto_number > META_PROTO_MAX) { |
|
|
if (opt_v > 1) println(yylval); |
|
|
if (opt_v > 1) println(yylval); |
|
|
map_append(outputProgram, yylval); |
|
|
|
|
|
|
|
|
outputNode(yylval); |
|
|
|
|
|
//map_append(outputProgram, yylval); |
|
|
continue; |
|
|
continue; |
|
|
} |
|
|
} |
|
|
if (opt_v > 1) printf("%s:%i: ", get(inputStack->name, String, value), inputStack->lineNumber); |
|
|
if (opt_v > 1) printf("%s:%i: ", get(inputStack->name, String, value), inputStack->lineNumber); |
|
@ -3904,6 +3892,8 @@ void outputTree(oop node, int depth) |
|
|
#undef CASE |
|
|
#undef CASE |
|
|
#undef OUT |
|
|
#undef OUT |
|
|
|
|
|
|
|
|
|
|
|
/** C nodes */ |
|
|
|
|
|
|
|
|
#define CASE(NAME) case t_C_##NAME:printf("%s:\n", #NAME); |
|
|
#define CASE(NAME) case t_C_##NAME:printf("%s:\n", #NAME); |
|
|
#define OUT(NAME) printSpace(depth+DELTA) ; outputValue(map_get(node, NAME##_symbol)); |
|
|
#define OUT(NAME) printSpace(depth+DELTA) ; outputValue(map_get(node, NAME##_symbol)); |
|
|
CASE(int) |
|
|
CASE(int) |
|
@ -4208,6 +4198,9 @@ void outputTree(oop node, int depth) |
|
|
OUT(attributeL); |
|
|
OUT(attributeL); |
|
|
OUT(expression); |
|
|
OUT(expression); |
|
|
break; |
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
/** Meta nodes */ |
|
|
|
|
|
|
|
|
default: |
|
|
default: |
|
|
printf("I cannot print a node with proto_number %i\n", proto_number); |
|
|
printf("I cannot print a node with proto_number %i\n", proto_number); |
|
|
exit(0); |
|
|
exit(0); |
|
@ -4216,8 +4209,8 @@ void outputTree(oop node, int depth) |
|
|
#undef OUT |
|
|
#undef OUT |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void printTree() { |
|
|
|
|
|
outputTree(yylval, 0); |
|
|
|
|
|
|
|
|
void printTree(oop element) { |
|
|
|
|
|
outputTree(element, 0); |
|
|
printf("\n"); |
|
|
printf("\n"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -4297,13 +4290,16 @@ int main(int argc, char **argv) |
|
|
repled= 1; |
|
|
repled= 1; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!repled) { |
|
|
if (!repled) { |
|
|
readEvalPrint(globals, NULL); |
|
|
readEvalPrint(globals, NULL); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
for (size_t i= 0; i < map_size(outputProgram); ++i) { |
|
|
for (size_t i= 0; i < map_size(outputProgram); ++i) { |
|
|
oop element= get(outputProgram, Map, elements)[i].value; |
|
|
oop element= get(outputProgram, Map, elements)[i].value; |
|
|
outputNode(element); |
|
|
|
|
|
|
|
|
if (toPrint) printTree(element); |
|
|
|
|
|
//else outputNode(element); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (opt_g) { |
|
|
if (opt_g) { |
|
@ -4313,25 +4309,12 @@ int main(int argc, char **argv) |
|
|
else printf("[GC: %.2f GB allocated]\n", (double)nalloc / (1024*1024*1024)); |
|
|
else printf("[GC: %.2f GB allocated]\n", (double)nalloc / (1024*1024*1024)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
popScope(); |
|
|
|
|
|
assert(!actualScope); |
|
|
|
|
|
return 0; |
|
|
|
|
|
|
|
|
|
|
|
(void)yyAccept; |
|
|
|
|
|
|
|
|
|
|
|
/**/ |
|
|
|
|
|
|
|
|
|
|
|
inputStackPush(NULL); |
|
|
|
|
|
while (yyparse()) { |
|
|
|
|
|
if (toPrint) printTree(); |
|
|
|
|
|
else outputNode(yylval); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
popScope(); |
|
|
popScope(); |
|
|
assert(!actualScope); |
|
|
assert(!actualScope); |
|
|
return 0; |
|
|
return 0; |
|
|
|
|
|
|
|
|
/**/ |
|
|
|
|
|
|
|
|
(void)yyAccept; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// Local Variables: |
|
|
// Local Variables: |
|
|