Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2005-07-31 (23:39)
From: skaller <skaller@u...>
Subject: Re: [Caml-list] buidlExpressionParser
On Sun, 2005-07-31 at 23:21 +1000, Pietro Abate wrote:
> Hi all,
> I'm trying to write a generic parser similar to the buidlExpressionParser
> in the haskel library (without using external libraries). I came up with
> a kind of hack that uses the grammar extension mechanism (attached).
> 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?

> 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 would not call this system 'simple' but it is entirely combinator
based, and generates a lex style deterministic finite state automaton.

You may want an NFA based interpreter instead though.

John Skaller <skaller at users dot sourceforge dot net>