From: Oliver Bandel <oliver@first.in-berlin.de>
To: caml-list@inria.fr
Subject: using different lexers with one parser?
Date: Tue, 17 Apr 2007 22:33:11 +0200 [thread overview]
Message-ID: <20070417203311.GA553@first.in-berlin.de> (raw)
Hello,
using many parsers with ocamlyacc
is possible, because ocamlyacc provides the possibility
forusing moire than one start-token.
Using many lexers is possible with ocamllex,
because each lexer is a seperated function.
Is it possible (without too much effort) to switch
the lexer during parsing (from within the parser)?
Or is better to
a) implement calling of different lexers in the *.mll file
or
b) use many starting-points of the *.mly-file and
work on the data from the outside of the parser
(I'm meaning here: the function that calls the
yacc-grammar-rule (start-rule)?
So: does it rather make sense to make a higher-level
parse on the data that the *.mly-parser gives back?!
BTW: The data (line-based) I want to parse could otherwise
be parsed relatively easy with regexp's; maybe
this is the better way?
Or is there a way to convert such context-dependend
things to ocamllex/ocamlyacc-syntaxes?
(It seems to me that similar problems arise, when parsing
files like picture-files or movie-files (mpg or so).)
TIA,
Oliver
next reply other threads:[~2007-04-17 20:33 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-17 20:33 Oliver Bandel [this message]
2007-04-18 7:38 ` [Caml-list] " Hendrik Tews
2007-04-18 10:01 ` Oliver Bandel
2007-04-18 14:21 ` skaller
2007-04-19 7:42 ` Hendrik Tews
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=20070417203311.GA553@first.in-berlin.de \
--to=oliver@first.in-berlin.de \
--cc=caml-list@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