English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
using different lexers with one parser?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2007-04-19 (07:42)
From: Hendrik Tews <H.Tews@c...>
Subject: Re: [Caml-list] using different lexers with one parser?
skaller <skaller@users.sourceforge.net> writes:

   This leaves the problem of the lookahead token, which
   may or may not exist. You can predict whether it exists
   for each reduction. You can do this 'mentally' by asking
   "Does this production have a definite set of terminators,
   (no lookahead) or does it rely on bumping 
   into something unrecognizable (lookahead)"?

I believe that in the grammar.output file you can pretty easy
see, which rules require a lookahead token. A state with two
reduce rules or one shift and one reduce rules obviously needs a
lookahead token. You would have to check that those reductions
that change the lexer are done in a state with precisely one
reduction. Of course you would have to do that every time you
change the grammar...