This sample, contributed by Don Syme of Microsoft Research, shows how to use F# in conjunction with LexerGenerator and ParserGenerator. Version 0.6.4 of the F# compiler, available from Microsoft Research at http://research.microsoft.com/downloads, includes this sample.
The sample is made up of the F# type declarations for the Abstract Syntax Tree types in ast.ml, the definition of the lexer in lang.lexer, the definition of the token types and parser in lang.parser (this includes actions written in C# which create the F# types corresponding to abstract syntax trees), and F# driver program main.ml.