CFG Parser banner


Period: February 2019
Languages: OCaml
This project involved the implementation of a simple parser to parse context-free grammars (CFGs) that when given a string whose prefix is a program to parse, returns the corresponding unmatched suffix. The key component of this assignment is that of a matcher, which is a function that inspects a given string of terminals to find a match for a prefix that corresponds to a nonterminal symbol of a grammar, and then checks whether the match is acceptable by testing whether a given acceptor (i.e. a function that accepts a rule list and a suffix and returns some value wrapped inside the Some constructor) succeeds on the corresponding suffix.

GitHub Source Code