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
Testing lexers and parsers
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2007-02-27 (15:42)
From: Denis Bueno <dbueno@g...>
Subject: Re: [Caml-list] Testing lexers and parsers
On 2/27/07, Joel Reymont <> wrote:
> Is there a better way to accomplish this while still using structural
> comparison of ASTs?
> Should I try to read my target AST into OCaml, for example? Should I
> create a bunch of "target AST" modules with functions that return my
> target AST?

I recently had to deal with this problem. I ended up testing the
parsing/printing by parsing a file, printing it out, and parsing the
print-out, and then making sure the ASTs built up are structurally
identical (modulo any position fields you might have lurking in your

I have to say, ever since I did this testing, I have had no problems
with my parser.