[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Pietro Abate <Pietro.Abate@a...> |
| Subject: | Re: [Caml-list] buidlExpressionParser |
On Mon, Aug 01, 2005 at 09:39:31AM +1000, skaller wrote:
> > Is there a better way of doing this ?
> Do I understand right: you're leveraging the camlp4 library
> code to build a general purpose LL(1) parser which will support
> runtime extension?
yep, I tought it was a kinda of creative way of using it...
now I've to convince ocamlfind to compile it properly :)
I'm not sure that this can be a general solution,
but for my small calculator-like example works well.
> > Does anybody have an example on how to write a simple lexer that I can
> > use instead ?
> Hmmm ... don't know about 'simple lexer' but I have a library
> function that can translate a representation of a labelled sequence
> of regexps into a tokeniser.
I'll be happy to have a look at this function...
> You may want an NFA based interpreter instead though.
I was thinking of using the Token interface in the Camlp4 library
that is, if f = Token.lexer_func_of_parser <some parser>
maybe your function can be used here ...
then the glexer would be something like:
{ Token.tok_func = f;
Token.tok_using = (fun _ -> ());
Token.tok_removing = (fun _ -> ());
Token.tok_match = Token.default_match;
Token.tok_text = Token.lexer_text }
:)
p
--
++ Blog: http://blog.rsise.anu.edu.au/?q=pietro
++
++ "All great truths begin as blasphemies." -George Bernard Shaw
++ Please avoid sending me Word or PowerPoint attachments.
See http://www.fsf.org/philosophy/no-word-attachments.html