The Ast_mapper module contributed by Alain Frisch to recent versions of the OCaml distribution allows you to perform arbitrary transformations from AST to AST in a convenient way. In particular, you could implement a erase-all-locations pass by simply overloading the "location" method (it uses object-oriented style for open recursion) to always return a dummy value. On Thu, Nov 6, 2014 at 6:05 PM, Christoph Höger < christoph.hoeger@tu-berlin.de> wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Dear all, > > is there a way to compare two abstract syntax trees for equality > without taking into account locations? Or rather a way to stratify the > location information inside a parsetree? I want to unit-test a parser > that invokes the OCaml parser itself. > > regards, > > Christoph > - -- > Christoph Höger > > Technische Universität Berlin > Fakultät IV - Elektrotechnik und Informatik > Übersetzerbau und Programmiersprachen > > Sekr. TEL12-2, Ernst-Reuter-Platz 7, 10587 Berlin > > Tel.: +49 (30) 314-24890 > E-Mail: christoph.hoeger@tu-berlin.de > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1 > > iEYEARECAAYFAlRbqj0ACgkQhMBO4cVSGS/rZgCfTspQtv/TYKjf8ZgeuF8XbyUE > 6UYAn0HNDMobnLCQOSRpyjdAPyoRPRGf > =eXX/ > -----END PGP SIGNATURE----- > > -- > Caml-list mailing list. Subscription management and archives: > https://sympa.inria.fr/sympa/arc/caml-list > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs >