|Symbol Table problems in Pascal languages family firstname.lastname@example.org (1996-10-08)|
|Re: Symbol Table problems in Pascal languages family email@example.com (1996-10-10)|
|Re: Symbol Table problems in Pascal languages family firstname.lastname@example.org (1996-10-15)|
|Re: Symbol Table problems in Pascal languages family email@example.com (David L Moore) (1996-10-15)|
|Re: Symbol Table problems in Pascal languages family firstname.lastname@example.org (1996-10-16)|
|From:||email@example.com (Christian Luginbuehl)|
|Date:||15 Oct 1996 09:39:10 -0400|
|Organization:||Simultan AG, Altishofen|
Paulo Jose Matos Lopes Pinto <firstname.lastname@example.org> wrote:
> I'm trying to do a compiler for a language that derives from Pascal
> The problem is with the symbol table for types, because the types have to
>be type-name compatible and not structured compatible, that makes a bit hard
>to manipulate the builtin names,like CHAR, REAL, among others.
>If you really look at the Pascal lined languages you realize that
>builtins are reserved and may not be used as (declarable)
In Oberon, the names of the builtin types like CHAR are not reserved
keywords the way BEGIN, IF, and so on are. They are _predefined
identifiers_; that means it looks as if they were in the symbol table
as soon as the compiler starts.
An easy way to implement this is to do it exactly like that: Insert
the entries for these predefined types into the symbol table before
you start compiling a module. Open a new scope (as you would do at the
start of a procedure) afterwards, since it is perfectly legal to
redeclare a predefined identifier as in
TYPE INTEGER = LONGINT;
VAR INTEGER : LONGINT;
[ Of course, this does not mean you _should_ do that :-) ]
You can do similar things for the built in procedures (like LEN, SHORT, ORD).
Good luck, Christian.
Christian Luginbuehl email@example.com
Simultan AG, Altishofen, Switzerland.
Return to the
Search the comp.compilers archives again.