[antlr-interest] Re: Layout processing

lachinois2002 lachinois at hotmail.com
Tue Jan 13 13:45:31 PST 2004


Hi Loring, thanks for your pointer it has proven very usefull.

However, it does not completely solve my problem... Maybe Terence 
can give me some further cues when he has some time. The problem 
arrises when I want to convert a document to SGML and the DTD 
specifies inclusions (that is elements that can appear anywhere 
between other elements).

Here is a quick example of what I would like to accomplish.

For example, lets say I have a rule:

a: b c

It should have been written like this if we wanted to consider 
possible inclusions:

a: b (inc)* c

Now, if I (only) had:

a: b c? d?

Things get much more messy to avoid running into infinite lookahead 
problems... (imagine a fully fledged rule)

a: (b (inc)* c)=>
   (
     b (inc)*
     (
       (c (inc)* d) =>
       (
         c (inc)* d
       )
       |
       d
     )
   )
   |
   (b (inc)* d)=>
   (
     b (inc)* d
   )
   |
   b

I could write a pre-processor that would rewrite all my rules with 
all the various combinations *, + and | that can arrise. However 
this is a big task...

Dont forget that sometimes in the DTD inc can appear explicitly.

I'm not sure I can accomplish something similar using actions and 
overriding default lexer/parser/tree/token behavior...

Daniel Shane 
     

--- In antlr-interest at yahoogroups.com, "lgcraymer" <lgc at m...> wrote:
> Daniel--
> 
> Ter's busy moving into his new domicile or he would probably 
answer.  Check out his "preserving token sequence" stuff 
> 
<http://www.antlr.org/article/preserving.token.order/preserving.token
.order.tml>; my impression is that may help.
> 
> --Loring



 

Yahoo! Groups Links

To visit your group on the web, go to:
 http://groups.yahoo.com/group/antlr-interest/

To unsubscribe from this group, send an email to:
 antlr-interest-unsubscribe at yahoogroups.com

Your use of Yahoo! Groups is subject to:
 http://docs.yahoo.com/info/terms/ 




More information about the antlr-interest mailing list