Re: Example interpreter C

Laurence Finston <lfinsto1@gwdg.de>
16 Aug 2005 11:16:05 -0400

          From comp.compilers

Related articles
Example interpreter C henryb@ntlworld.com (Henry Butwsky) (2005-08-13)
Re: Example interpreter C lfinsto1@gwdg.de (Laurence Finston) (2005-08-16)
Re: Example interpreter C dido@imperium.ph (Rafael 'Dido' Sevilla) (2005-08-16)
Re: Example interpreter C haberg@math.su.se (2005-08-21)
Re: Example interpreter C lfinsto1@gwdg.de (Laurence Finston) (2005-08-21)
Re: Example interpreter C gneuner2@comcast.net (George Neuner) (2005-08-24)
Re: Example interpreter C Markus.Elfring@web.de (2005-08-24)
Re: Example interpreter C der_julian@web.de (Julian Stecklina) (2005-08-31)
[8 later articles]
| List of all articles for this month |
From: Laurence Finston <lfinsto1@gwdg.de>
Newsgroups: comp.compilers
Date: 16 Aug 2005 11:16:05 -0400
Organization: GWDG, Goettingen
References: 05-08-055
Keywords: C, interpreter, comment
Posted-Date: 16 Aug 2005 11:16:05 EDT

On Sat, 13 Aug 2005, Henry Butwsky wrote:


> I have written a basic parser (with flex and Bison) that evaluates
> simple expressions , but now I want to add IF/THEN construct and also
> loops
>
> I understand that I need to write a parser that creates and AST
> (abstract symbol table) . Can any one point in the direction of an
> such an expale interpreter ?


> [Uh, AST stands for Abstract Syntax Tree. You'll find a lot more
> references if you use the right name. -John]


I don't know what "expale" is, nor what an abstract syntax tree is.
However, I have written an interpreter with conditionals and loops.
I've also implemented macros using similar techniques.
It's available at:
http://savannah.gnu.org/cgi-bin/viewcvs/3dldf/3dldf/Group/CWEB/
The input files for the parser have names of the pattern "p*.w".
The one with the rules for loops is 'ploops.w' and the one with
rules for conditionals is 'pcondit.w'.


This topic also comes up regularly on the "help-bison" mailing list.
You might want to check the archives:
http://lists.gnu.org/archive/html/help-bison/


Laurence Finston
http://www.gnu.org/software/3dldf/LDF.html
[Expale is a typo for example, and I have to say that if you don't know what
an AST is, you should consider learning a little about compiler basics. -John]


Post a followup to this message

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