The goal of this exercise it to have a minimal parser which will parse expressions as the ML languages do.
Namely to have function application to have the highest priority. The key to this seems to have a minimal set of productions
in the base
rule. The app
rule defines that application groups to the left.
The type expr
from Syntax
module has the following interpretation: Int
-s are numbers,
Fn
-s are predefined function names and App
and Plus
have the obvious and natural meaning.
A way to test it is to run mehnir --interpret --interpret-show-cst parser.mly