Re: target language grammars.

Lujop <lujoplujop@gmail.com>
7 Nov 2004 12:07:56 -0500

          From comp.compilers

Related articles
target language grammars. ralphpboland@yahoo.com (2004-11-06)
Re: target language grammars. cppljevans@cox-internet.com (Larry Evans) (2004-11-07)
Re: target language grammars. dobes@dobesland.com (Dobes Vandermeer) (2004-11-07)
Re: target language grammars. lujoplujop@gmail.com (Lujop) (2004-11-07)
Re: target language grammars. vbdis@aol.com (2004-11-07)
Re: target language grammars. cgweav@aol.com (2004-11-07)
Re: target language grammars. kenrose@tfb.com (Ken Rose) (2004-11-14)
Re: target language grammars. idbaxter@semdesigns.com (Ira Baxter) (2004-11-14)
target language grammars. a.t.hofkamp@tue.nl (A.T. Hofkamp) (2004-11-14)
Re: target language grammars. zbigniew@planet.nl (Zbigniew Chamski) (2004-11-14)
| List of all articles for this month |
From: Lujop <lujoplujop@gmail.com>
Newsgroups: comp.compilers
Date: 7 Nov 2004 12:07:56 -0500
Organization: Compilers Central
References: 04-11-013
Keywords: parse, code
Posted-Date: 07 Nov 2004 12:07:56 EST

On 6 Nov 2004 15:15:09 -0500, Ralph Boland <ralphpboland@yahoo.com> wrote:


> Does it make sence to make use of a grammar of the target language in
> any way? Can anyone point to applications where the target language
> grammar is made use of?


Terence Parr (ANTLR creator) has published and article in
CodeGeneration about this. You can see it in
http://www.codegeneration.net/tiki-read_article.php?articleId=65


I cut&paste a part of the article:
"...


Most programs that emit source code or other text output are
unstructured blobs of generation logic interspersed with print
statements. The primary reason is the lack of suitable tools and
formalisms. The proper formalism is that of an output grammar because
you are not generating random characters--you are generating sentences
in an output language. This is analogous to using a grammar to
describe the structure of input sentences. Rather than building a
parser by hand, most programmers will use a parser generator.
Similarly, we need some form of ``unparser generator'' to generate
text. The most convenient manifestation of the output grammar is a
template engine such as StringTemplate, the engine used in this
article.


..."


Cheers,


--
Lujop



Post a followup to this message

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