void main (void) { c_char(); c_int(); c_long(); success = failures; done (); }
void main (void) { c_char(); c_int(); c_long(); int0 = -1; c_uminus(); if(int1 != 1) failures++; success = failures; done (); }
static void c_code(struct s_node *n, enum opt_assign a) { /* XXX except for a couple of desugared cases, there is always a coords as * a first child of expr, so it would be better to fix sugar.c and assert * here */ if (n->first && n->first->type == coords) { int i; c_strln(""); c_str("#line "); c_int(n->first->pair[0]); c_str(" \""); c_str(arg_input()); c_strln("\""); /* 1-based counting; subtract 1 for upcoming '(' and maybe '=' */ for (i = 1; i < n->first->pair[1] - 1 - assign; ++i) putchar(' '); } if (a) putchar('='); putchar('('); c_raw(n->text); putchar(')'); if (a) putchar(';'); c_raw("\n"); /* now a #line to take us back to the C output; line number of next line */ c_str("#line "); c_long(nr + 1); c_str(" \""); c_str(arg_output()); c_strln("\""); }
int main (void) { opentest(OUTFILE); c_char(); c_int(); c_long(); int0 = -1; c_uminus(); if(int1 != 1) failures++; success = failures; done (); fprintf(outfile,"failures: %d\n",failures); closetest(THISFILE); return (0); }
static void grammar_pre(struct s_node *n) { int i, r = 0; struct s_node *p; static int cooked = 0; g_node = n; if (arg_defines()) { c_str("#include \"");c_str(arg_defines());c_strln("\""); if (arg_feed() && cooked) { c_strln("#undef PACC_NAME"); c_strln("#define PACC_NAME PACC_FEED_NAME"); } } else c_defines(); ++cooked; pre_decl(); /* We slightly simplify both building & walking the tree and insist * that every grammar starts with a preamble, which may be null. * It's a bit odd to represent no preamble with an empty preamble * node. */ p = n->first; assert(p->type == preamble); if (!arg_defines() && p->text) c_raw(p->text); p = p->next; for ( ; p; p = p->next) { assert(p->type == rule); ++r; } c_str("static const int n_rules = "); c_int(r); c_semi(); c_str("static const int start_rule_id = "); c_long(n->first->next->id); c_semi(); g_name = n->text; /* type of start rule is always u0 */ type_list(n->first->next->first->text); for (p = n->first; p; p = p->next) if (p->type == rule) type_list(p->first->text); c_str("union PACC_SYM(vals)"); c_open(); for (i = 0; i < t_max; ++i) { c_str(t_list[i]); c_str(" u"); c_int(i); c_semi(); } c_close(); c_semi(); /* XXX just for debugging */ c_str("#define TYPE_PRINTF "); if (strcmp(n->first->next->first->text, "int") == 0) c_str("\"%d\""); else if (strcmp(n->first->next->first->text, "char *") == 0) c_str("\"%s\""); else c_str("\"%p\""); c_strln(""); c_str("#define PACC_TYPE "); c_strln(n->first->next->first->text); pre_engine(); c_str("_st="); c_long(n->first->type == preamble ? n->first->next->id : n->first->id); c_semi(); c_strln("goto top;"); c_strln("contin:"); c_strln("_st=_cont;"); c_strln("PACC_TRACE fprintf(stderr, \"continuing in state %d\\n\", _cont);"); c_strln("top:"); c_strln("PACC_TRACE fprintf(stderr, \"switch to state %d\\n\", _st);"); c_str("switch(_st)"); c_open(); }