caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* using different lexers with one parser?
@ 2007-04-17 20:33 Oliver Bandel
  2007-04-18  7:38 ` [Caml-list] " Hendrik Tews
  0 siblings, 1 reply; 5+ messages in thread
From: Oliver Bandel @ 2007-04-17 20:33 UTC (permalink / raw)
  To: caml-list

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2007-04-19  7:42 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-04-17 20:33 using different lexers with one parser? Oliver Bandel
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

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).