The F# Parsing Sample

Links: Up

This sample shows how to write a simple parser and lexer using F#, and the tools fslex and fsyacc in particular.

The sample is made up of the F# type declarations for the Abstract Syntax Tree types in ast.fs, the definition of the lexer in lex.fsl, the definition of the token types and parser in pars.fsy , an interpeter for the language in interp.fs and an F# driver program that plugs the parser and the interpreter together, in main.fs.

Suggested Exercises