Re: Two pass compiler for a language similar to Java

"Lasse =?ISO-8859-1?Q?Hiller=F8e?= Petersen" <lhp+news@toft-hp.dk>
13 Sep 2004 10:50:46 -0400

          From comp.compilers

Related articles
Two pass compiler for a language similar to Java joanpujol@gmail.com (=?ISO-8859-1?Q?Joan_Jes=FAs_Pujol_Espinar?=) (2004-09-03)
Re: Two pass compiler for a language similar to Java kamalp@acm.org (2004-09-07)
Re: Two pass compiler for a language similar to Java jjan@cs.rug.nl (J.H.Jongejan) (2004-09-08)
Re: Two pass compiler for a language similar to Java lhp+news@toft-hp.dk (Lasse =?ISO-8859-1?Q?Hiller=F8e?= Petersen) (2004-09-13)
Re: Two pass compiler for a language similar to Java vidar@hokstad.name (2004-09-13)
Re: Two pass compiler for a language similar to Java joanpujol@gmail.com (Joan Pujol) (2004-09-13)
Re: Two pass compiler for a language similar to Java tzvetanmi@yahoo.com (2004-09-13)
Re: Two pass compiler for a language similar to Java kers@hplb.hpl.hp.com (Chris Dollin) (2004-09-13)
Re: Two pass compiler for a language similar to Java kamalp@acm.org (2004-09-21)
| List of all articles for this month |

From: "Lasse =?ISO-8859-1?Q?Hiller=F8e?= Petersen" <lhp+news@toft-hp.dk>
Newsgroups: comp.compilers
Date: 13 Sep 2004 10:50:46 -0400
Organization: No Organization
References: 04-09-032 04-09-051 04-09-068
Keywords: design, Pascal
Posted-Date: 13 Sep 2004 10:50:45 EDT

"J.H.Jongejan" <jjan@cs.rug.nl> wrote:
> Kamal R. Prasad wrote:
> > Joan Jesús Pujol Espinar <joanpujol@gmail.com> wrote
> >
> >
> >>I'm doing a pseudocode language similar to Java (it is posible to use
> >>things before are defined).


> > A procedural language does require a 2-pass compiler.


> Wirth actually designed the language in such a way that 1-pass would
> be possible.


Of course one of Wirth's design choices was precisely to require
things to be defined before use, if I'm not completely mistaken.


But perhaps a "fixup" method could be used? For function calls before
a function is defined, record the circumstances (apparent result and
argument types, and the location in the source), then when the
definition comes around, if it conflicts with recorded circumstances,
report an error at the original call occurrence. (Assume that the
definition is right and the call was wrong.)


-Lasse


Post a followup to this message

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