caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Francois Pottier <Francois.Pottier@inria.fr>
To: Dario Teixeira <darioteixeira@yahoo.com>
Cc: caml-list@inria.fr, Jeff Shaw <shawjef3@msu.edu>
Subject: Re: [Caml-list] Re: The lexer hack
Date: Tue, 10 Nov 2009 17:33:33 +0100	[thread overview]
Message-ID: <20091110163333.GD19182@yquem.inria.fr> (raw)
In-Reply-To: <698547.213.qm@web111509.mail.gq1.yahoo.com>


Hello,

On Tue, Nov 10, 2009 at 08:26:23AM -0800, Dario Teixeira wrote:
> Anyway, I was looking at Dypgen's early actions, and an idea
> occurred to me: I can create dummy empty actions that simply
> change a global "parsing context" variable:
> 
> inline:
>   | (...)
>   | BEGIN_VERB enter_verb RAW END_VERB exit_verb {Ast.Verbatim $3}
>   | (...)
> 
> enter_verb:  /* empty */  {Global.context := Global.Verbatim}
> exit_verb:   /* empty */  {Global.context := Global.General}
> 
> 
> Still hackish, but better than creating a state machine...

Interesting. Have you confirmed that this works? I am slightly worried by the
fact that an LR parser reads one token ahead, i.e. one token past BEGIN_VERB
might already have been read before the enter_verb semantic action is
executed. If that is so, then this token would be read while the lexer is
still in the wrong mode.

-- 
François Pottier
Francois.Pottier@inria.fr
http://gallium.inria.fr/~fpottier/


  reply	other threads:[~2009-11-10 16:33 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-10 15:26 Jeff Shaw
2009-11-10 16:26 ` [Caml-list] " Dario Teixeira
2009-11-10 16:33   ` Francois Pottier [this message]
2009-11-10 16:48     ` Dario Teixeira
2009-11-11 11:03       ` Martin Jambon
2009-11-14 18:19         ` Dario Teixeira

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20091110163333.GD19182@yquem.inria.fr \
    --to=francois.pottier@inria.fr \
    --cc=caml-list@inria.fr \
    --cc=darioteixeira@yahoo.com \
    --cc=shawjef3@msu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).