Skip to content
This repository has been archived by the owner on Jun 15, 2021. It is now read-only.

Latest commit

 

History

History
15 lines (10 loc) · 939 Bytes

README.markdown

File metadata and controls

15 lines (10 loc) · 939 Bytes

Vaughan

Vaughan is an F# implementation of a generic Top-Down-Operator-Precedence Parser as described in this paper, it borrows it's name from the algorithms original inventor Vaughan Pratt.

It has been extended to allow for statements in comparison to Pratt's original algorithm which only parsed languages which use expression-only grammar.

The parser is "impure" in the sense that is uses a ref-cell for storing the input in the T<_, _, _> record class, this is soley for performance reasons as it's to expensive to create a new record object for every consumed token. Certain functions also throw exceptions, which generally also is considered impure.

Pretty printed error messages are produced, such as:

Error on line: 5 col: 9
4: if(x == y) {
5:   print'x equals y');
----------^
Unexpected: #string "x equals y"