xotl.fl - Language API and AST

xotl.fl.parse(program_source: str, *, debug: bool = False)[source]

Parse the program source and return its AST.

It returns a list of definitions. Definitions come in five types:

This function doesn’t type-check the program.

Example:

>>> parse("""
...    data List a = Nil | Cons a (List a)
...    lhead :: List a -> a
...    lhead (Cons a _) = a
... """)
[<Data List a = <DataCons Nil> | <DataCons Cons a (List a)>>,
 {'lhead': <TypeScheme: forall a. (List a) -> a>},
 <equation lhead (Cons a _) = Identifier('a')>]