Re: target language grammars.

Lujop <>
7 Nov 2004 12:07:56 -0500

          From comp.compilers

Related articles
target language grammars. (2004-11-06)
Re: target language grammars. (Larry Evans) (2004-11-07)
Re: target language grammars. (Dobes Vandermeer) (2004-11-07)
Re: target language grammars. (Lujop) (2004-11-07)
Re: target language grammars. (2004-11-07)
Re: target language grammars. (2004-11-07)
Re: target language grammars. (Ken Rose) (2004-11-14)
Re: target language grammars. (Ira Baxter) (2004-11-14)
target language grammars. (A.T. Hofkamp) (2004-11-14)
Re: target language grammars. (Zbigniew Chamski) (2004-11-14)
| List of all articles for this month |

From: Lujop <>
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 <> 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

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




Post a followup to this message

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