Re: How to construct a grammar?

Detlef Meyer-Eltz <Meyer-Eltz@t-online.de>
Sat, 5 Jul 2008 16:49:04 +0200

          From comp.compilers

Related articles
How to construct a grammar? michael@schuerig.de (Michael Schuerig) (2008-07-05)
Re: How to construct a grammar? Meyer-Eltz@t-online.de (Detlef Meyer-Eltz) (2008-07-05)
Re: How to construct a grammar? cfc@shell01.TheWorld.com (Chris F Clark) (2008-07-05)
Re: How to construct a grammar? michael@schuerig.de (Michael Schuerig) (2008-07-05)
Re: How to construct a grammar? cfc@shell01.TheWorld.com (Chris F Clark) (2008-07-06)
Re: How to construct a grammar? ArarghMail806@Arargh.com (2008-07-06)
Re: How to construct a grammar? quinn_jackson2004@yahoo.ca (Quinn Tyler Jackson) (2008-07-07)
| List of all articles for this month |

From: Detlef Meyer-Eltz <Meyer-Eltz@t-online.de>
Newsgroups: comp.compilers
Date: Sat, 5 Jul 2008 16:49:04 +0200
Organization: Compilers Central
References: 08-07-011
Keywords: parse
Posted-Date: 05 Jul 2008 13:01:50 EDT

> So, I'm wondering, is there a systematic way to get from a suitable
> list of language samples, i.e, without a formal definition to start
> with, to a grammar?


Caution: I will make some advertising of my own parser generator
product. But it was made just with such tasks in mind.


I often was engaged in similar tasks and I have tried to make a short
guide from my experiences.


http://www.texttransformer.com/tthelp/howtobegin.htm


The essential statement is: first write a rough parser, which can
process the whole sample and then refine the grammar peu ` peu. This
is possible with TextTransformer, because there is a special SKIP
token, by which unrecognized parts of text can be omitted in the
beginning.


TextTransformer is particularly suitable for this task, because you
can test your language samples easily in a visual way. Finally all
available language samples can be tested at once with the integrated
transformation-manager. If the parser fails at a certain file, it can
be opened by a double click in the TextTransformer IDE for debugging.
After you have corrected the grammar, you can quickly test all samples
again.


I have repeatedly used this method successfully. Among others for the
translation of a not specified BASIC dialect into Java and on several
unspecified table formats. This way a grammar for Borlands Delphi also
almost is completed.


Regards


Detlef


Post a followup to this message

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