Related articles |
---|
Making my first compiler szigetir@gmail.com (2006-09-16) |
Re: Making my first compiler pjb@informatimago.com (Pascal Bourguignon) (2006-09-18) |
Re: Making my first compiler tommy.thorn@gmail.com (Tommy Thorn) (2006-09-18) |
Re: Making my first compiler idknow@gmail.com (idknow@gmail.com) (2006-09-18) |
Re: Making my first compiler torbenm@app-1.diku.dk (2006-09-18) |
Re: Making my first compiler jeffrey.kenton@comcast.net (Jeff Kenton) (2006-09-25) |
Re: Making my first compiler firefly@diku.dk (Peter \Firefly\Lund) (2006-09-25) |
Re: Making my first compiler monnier@iro.umontreal.ca (Stefan Monnier) (2006-11-23) |
Re: Making my first compiler ValdoFerrari@libero.it (Valdo Ferrari) (2006-11-24) |
Re: Making my first compiler torbenm@app-0.diku.dk (2006-11-27) |
[7 later articles] |
From: | "idknow@gmail.com" <idknow@gmail.com> |
Newsgroups: | comp.compilers |
Date: | 18 Sep 2006 09:47:15 -0400 |
Organization: | Compilers Central |
References: | 06-09-087 |
Keywords: | design |
Posted-Date: | 18 Sep 2006 09:47:15 EDT |
szigetir@gmail.com wrote:
> I'm trying to create a pascal subset interpreter/compiler.
>
> Do I HAVE to create a syntax tree? Or can I go straight to creating
> Intermediate Code (Quadruples) in Yacc's reduce actions?
>
> Say I have a generic paramater_list (for function definitions) in BNF ,
> eg:
>
> paramater_list: paramater_list paramater
>
> In Yacc, would this be connected together as a linked-list?
> paramater_list: paramater_list paramater { $$ = make_paramater($2);
> $$->next = $1; }
> | paramater { $$ = make_paramater($1); }
> ;
>
> What's a basic structure for a syntax tree in C?
>
> Say I want my compiler to convert Pascal code to C code, which steps
> are absolutely necessary to do this correctly?
> Im thinking:
> Build Syntax Tree -> Convert it to Three Address Code (Quadruples) ->
> then into C
> Was this correct?
SZigetir, the compiler, the compiler and the output are whatever you
design it to be! As the author and designer, you have complete liberty
to be imaginative and improvisational to accomplish whatever you want
your code to do.
However, you will have to explain and apologise to users of your
language for each and every limitation you encode in your language, so
do attempt to eliminate them.
Eliminate complextity; make it as simple as possible but no simpler.
and of course, enjoy yourself!
Return to the
comp.compilers page.
Search the
comp.compilers archives again.