How to generate a symbol table for a Pascal-subset compiler in C? -


i'm writing compiler in c, interpret pseudo-pascal instructions (their syntax irrelevant) asm output. know now, need:

  • a syntax scanner scan user input , identify tokens parser process
  • a parser check if tokens fit defined grammar productions
  • a symbol table

i'm little bit stuck on important phase - symbol table. i'm unsure should included in table. variables (identifiers), address. should include keywords such if, for etc? guidelines on appreciated.

for now, think logical way define structure:

struct entry{     char* name;     vartype vartype;     int address; } 

where vartype enum available variable types (integer , real). ofc make array of structures , expand when necessary. how , when should modify it?

here awsome free book: compiler design in c


Comments

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

javascript - Complex json ng-repeat -

jquery - Cloning of rows and columns from the old table into the new with colSpan and rowSpan -