Related articles |
---|
[3 earlier articles] |
Re: Suggestion for dynamic grammar/parser - pls advise cfc@shell01.TheWorld.com (Chris F Clark) (2007-03-29) |
Re: Suggestion for dynamic grammar/parser - pls advise mefrill@yandex.ru (mefrill) (2007-03-30) |
Re: Suggestion for dynamic grammar/parser - pls advise nicola.musatti@gmail.com (Nicola Musatti) (2007-03-30) |
Re: Suggestion for dynamic grammar/parser - pls advise jsassojr@nycap.rr.com (John Sasso) (2007-03-30) |
Re: Suggestion for dynamic grammar/parser - pls advise jsassojr@nycap.rr.com (John Sasso) (2007-03-30) |
Re: Suggestion for dynamic grammar/parser - pls advise DrDiettrich1@aol.com (Hans-Peter Diettrich) (2007-04-01) |
Re: Suggestion for dynamic grammar/parser - pls advise Meyer-Eltz@t-online.de (Detlef Meyer-Eltz) (2007-04-01) |
Re: Suggestion for dynamic grammar/parser - pls advise Meyer-Eltz@t-online.de (Detlef Meyer-Eltz) (2007-04-01) |
From: | Detlef Meyer-Eltz <Meyer-Eltz@t-online.de> |
Newsgroups: | comp.compilers |
Date: | 1 Apr 2007 08:57:44 -0400 |
Organization: | Compilers Central |
References: | 07-03-106 07-03-113 07-03-122 |
Keywords: | parse |
Posted-Date: | 01 Apr 2007 08:57:44 EDT |
I followed the discussion about your problem so far and in my opinion
there is no general solution. But two suggestions were of special
interest and I have to add a third:
1. version numbering of the rules as suggested by Dodi
This is the usual method when writing serializers for classes. Under
this key point you certainly can find much literature. But this method
comes too late for you as previous grammars without versionning
already exist and also it would make the statements of your language
more complex.
2. trying one grammar after the other as suggested by Chris
With TextTransformer you indeed could write something like this:
IF( G1() )
G1
ELSE IF( G2() )
G2
ELSE
...
END END END
Here the same Grammr is tried first in a condition for an if-statement
and if it can parse the file, it will be used. Otherwise the next
grammar is tried. (When a production is used as a look-ahead in a
condition, no actions are executed.) You must pay attention exactly,
though, that a later language isn't interpretable wrongly by an
earlier grammar.
More efficient would be to apply this scheme to the sub-productions in
question. The special example of your first mail even don't need such
a procedure, because the original rule only is enlarged, by appending
further specifications. That's very easy to handle.
3. convert the older scripts to the last language
This suggestion occurs to me because such conversions can be made with
my TextTransformer tool quite easily. I would like to help you with
that.
Detlef
Return to the
comp.compilers page.
Search the
comp.compilers archives again.