a/c99.y b/c99.y
...
...
582
    | SWITCH '(' expression ')' statement
582
    | SWITCH '(' expression ')' statement
583
    ;
583
    ;
584
584
585
iteration_statement
585
iteration_statement
586
    : WHILE '(' expression ')' statement
586
    : WHILE '(' expression ')' statement
587
    { sprintf($<str>$, "WHILE %s DO\n%s\nEND_WHILE\n",$<str>3, $<str>5); }
587
    | DO statement WHILE '(' expression ')' ';'
588
    | DO statement WHILE '(' expression ')' ';'
588
    | FOR '(' expression_statement expression_statement ')' statement
589
    | FOR '(' expression_statement expression_statement ')' statement
589
    | FOR '(' expression_statement expression_statement expression ')' statement
590
    | FOR '(' expression_statement expression_statement expression ')' statement
590
    | FOR '(' declaration expression_statement ')' statement
591
    | FOR '(' declaration expression_statement ')' statement
591
    | FOR '(' declaration expression_statement expression ')' statement
592
    | FOR '(' declaration expression_statement expression ')' statement
...
...
614
    {
615
    {
615
        printf("%s %s %s %s", $<str>1, $<str>2, $<str>3, $<str>4);
616
        printf("%s %s %s %s", $<str>1, $<str>2, $<str>3, $<str>4);
616
    }
617
    }
617
    | declaration_specifiers declarator compound_statement
618
    | declaration_specifiers declarator compound_statement
618
    {
619
    {
619
        printf("%s %s %s", $<str>1, $<str>2, $<str>3);
620
        char *p;
621
        while( (p=fifo_pop(decl_all)) != NULL)
622
        {
623
            printf(p);
624
            printf("%s;\n", $<str>1);
625
        }
626
        printf($<str>3);
627
        strcpy($<str>$, "");
620
    }
628
    }
621
    ;
629
    ;
622
630
623
declaration_list
631
declaration_list
624
    : declaration
632
    : declaration
...
...
687
        fifo_push(type, p);
695
        fifo_push(type, p);
688
}
696
}
689
697
690
char *maptype(char *ctype)
698
char *maptype(char *ctype)
691
{
699
{
700
    if (!strcmp(ctype, "void"))
701
        return "BOOL";
702
692
    if (!strcmp(ctype, "char"))
703
    if (!strcmp(ctype, "char"))
693
        return "BYTE";
704
        return "BYTE";
694
    if (!strcmp(ctype, "short"))
705
    if (!strcmp(ctype, "short"))
695
        return "INT";
706
        return "INT";
696
    if (!strcmp(ctype, "int"))
707
    if (!strcmp(ctype, "int"))