|[2 earlier articles]|
|Re: target language grammars. email@example.com (Dobes Vandermeer) (2004-11-07)|
|Re: target language grammars. firstname.lastname@example.org (Lujop) (2004-11-07)|
|Re: target language grammars. email@example.com (2004-11-07)|
|Re: target language grammars. firstname.lastname@example.org (2004-11-07)|
|Re: target language grammars. email@example.com (Ken Rose) (2004-11-14)|
|Re: target language grammars. firstname.lastname@example.org (Ira Baxter) (2004-11-14)|
|target language grammars. email@example.com (A.T. Hofkamp) (2004-11-14)|
|Re: target language grammars. firstname.lastname@example.org (Zbigniew Chamski) (2004-11-14)|
|From:||"A.T. Hofkamp" <email@example.com>|
|Date:||14 Nov 2004 22:43:39 -0500|
|Posted-Date:||14 Nov 2004 22:43:39 EST|
> Can anyone point to applications where the target language
> grammar is made use of?
What about an interactive compiler construction environment where you
define a context-free source language, a context-free target language,
and a set of (functional-style) rewrite rules to rewrite input syntax
to output syntax (with the rewrite rules using both the input and the
The language that does this is called ASF+SDF, and the implementation
of it is called Meta. You can find it (with many publications) at
I have been using it for almost 2 years now for writing my compiler.
At first having everything based on grammars feels weird, but now I
wouldn't want to go back to the 'old' way with eg lex/yacc.
> Perhaps, in translating a program, we could generate a representation
> of the program as a parse tree in the target language and then
No need to do anything yourselves, Meta does it all for you.
> Mostly here I am thinking of cases where the target language is
> something like postscript, pdf, or latex. (The Lyx program translates
> Lyx files to latex files.)
Since the grammar is context-free, you get context-free output, for
example without proper indentation.
The grammar simply does not contain this layout-information, so it
cannot do layouting of the output.
On the other hand, since the output is available in a tree, you can
quite easily write a formatter if you want.
> I am particularly interested in the case that a target language
> program represents how some data is to be displayed on a computer
If you have a context-free grammar, Meta can give you the output in
Return to the
Search the comp.compilers archives again.