caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Robert Muller <robert.muller2@gmail.com>
To: O'Caml Mailing List <caml-list@yquem.inria.fr>
Subject: ocamllex question
Date: Tue, 10 Mar 2009 18:44:26 -0400	[thread overview]
Message-ID: <C312D72A-770B-4BC9-8458-91FD5AA1CB6D@gmail.com> (raw)

I am attempting to use ocamllex together with ocamlyacc to parse a  
subset of python. Python uses indentation to denote
statement blocks so a lexer is sometimes required to return a sequence  
of tokens without advancing the input pointer. In
particular, a lexer for python should return a sequence of so-called  
DEDENT tokens when indented fragments
end. E.g.,

def f(x):
	statement1;
	statement2;
		statement3;
		statement4;
A

the lexer should return two consecutive DEDENT tokens between the '\n'  
at the end of statement4 and the token for A.

Looking at the documentation and examples, it isn't clear how to  
convince the generated lexer to not advance the input pointer
so that two consecutive DEDENT tokens can be returned before the token  
for A is returned.

Any ocamllex perts out there?

Thanks,
Bob Muller


             reply	other threads:[~2009-03-10 22:44 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-10 22:44 Robert Muller [this message]
2009-03-11  0:43 ` [Caml-list] " Martin Jambon
  -- strict thread matches above, loose matches on Subject: below --
2005-10-23 18:02 Ocamllex question Matt Gushee
2005-09-21 18:34 ocamllex question skaller

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=C312D72A-770B-4BC9-8458-91FD5AA1CB6D@gmail.com \
    --to=robert.muller2@gmail.com \
    --cc=caml-list@yquem.inria.fr \
    /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).