Adding a front end to GCC (Paulo Jose Pinto - LEI)
18 Sep 1998 23:15:16 -0400

          From comp.compilers

Related articles
Adding a front end to GCC (1998-09-18)
| List of all articles for this month |

From: (Paulo Jose Pinto - LEI)
Newsgroups: comp.compilers
Date: 18 Sep 1998 23:15:16 -0400
Organization: Faculdade de Ciencias e Tecnologia, U.N.L., Portugal
Keywords: GCC, comment

        I'm planning to add a new front end for BASIC to GCC but I've
    found some problems. From what I've seen GCC creates the RTL in
    the first pass, after processing each function.
        In BASIC (the structured dialects that exist nowadays) allow you
    to call a SUB/FUNCTION/DEF FN that are declared later in the file,
    for example :


          SUB sum (a%, b%)
              PRINT "The result is", a% + b%
          END SUB

        In order to do the type check at the CALL we need to know the type
    of the args of the SUB but it is declared later in the file. To solve
    this I think that the type checking can only be done in the second pass
    or using something like backpatching in order to be able to do it in the
    first pass.
        But none of these are what GCC expects, so I would like to know if
    someone has any idea about how GCC can handle a front end to a 2 pass

| Paulo Pinto, |
| |
[I'd write a two-pass compiler, one pass to get all the types, the second
pass to generate the RTL. Just slurp the whole source file into core,
it's the GCC way. -John]

Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.