Version française
Home     About     Download     Resources     Contact us    
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: -- (:)
From: Denis Bueno <dbueno@g...>
Subject: Re: [Caml-list] Testing lexers and parsers
On 2/27/07, Joel Reymont <joelr1@gmail.com> 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
ASTs).

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

-Denis