Related articles |
---|
[15 earlier articles] |
Re: Is C++ really used ? cliffc@risc.sps.mot.com (Cliff Click) (1997-05-08) |
Re: Is C++ really used ? nasser@apldbio.COM (Nasser Abbasi) (1997-05-08) |
Re: Is C++ really used ? shankar@chromatic.com (1997-05-08) |
Re: Is C++ really used ? bduncan@tiac.net (Bruce Duncan) (1997-05-08) |
Re: Is C++ really used ? cfc@world.std.com (1997-05-12) |
Re: Is C++ really used ? jocelyn_coulmance@hol.fr (Jocelyn Coulmance) (1997-05-12) |
Re: Is C++ really used ? salomon@nickel.cs.umanitoba.ca (1997-05-13) |
From: | salomon@nickel.cs.umanitoba.ca (Daniel J. Salomon) |
Newsgroups: | comp.compilers |
Date: | 13 May 1997 22:56:56 -0400 |
Organization: | Computer Science, University of Manitoba, Winnipeg, Canada |
References: | 97-04-156 97-05-016 97-05-125 97-05-145 |
Keywords: | OOP, practice, parse |
Jocelyn Coulmance <jocelyn_coulmance@hol.fr> wrote:
|> You can easily produce an object-oriented parse tree out of BNF-like
|> syntax ...
Since my posting, it has been pointed out to me that one can perform a
recursive-descent parse using object-oriented techniques, provided one
is generating a parse-tree. One simply defines a class for each
nonterminal, then has the constructor for that class create the
appropriate node, and invoke the constructors for each of the subnodes
needed in the tree, based on the lookahead information.
The reason that I missed this technique was because neither of my
translator projects used a parse-tree as the intermediate form. One
project interpreted source directly, and another used three-address
code as the intermediate form for the translation.
I am grateful for those who pointed out the parse-tree method of designing
and object-oriented translator.
--
Daniel J. Salomon -- salomon@cs.UManitoba.CA
Dept. of Computer Science / University of Manitoba
Winnipeg, Manitoba, Canada R3T 2N2 / (204) 474-8687
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.