Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
This module contains a parser for our intermediate representation (IR).
The intermediate language is usually not parsed directly. It is more common for another language (e.g., Haskell) to be parsed and converted to out intermediate language. The main purpose of the IR parser is to easily construct AST nodes in unit tests without making the tests dependent on some front end for the construction of the AST.
The syntax of the intermediate language is based on Haskell. However,
there is only very little syntactic sugar. For example, there are no
infix operations, all applications are written in prefix notation.
Since the unary minus is actually syntactic sugar for negate
in Haskell,
there is also no unary minus in the intermediate representation.
Furthermore, the intermediate language does not implement Haskell's
layout rule.
The parser does not support source spans at the moment, all generated
nodes are annotated with NoSrcSpan
.
Documentation
class Parseable a where Source #
Type class for IR nodes that can be parsed.
The parser to use for IR nodes of type a
.
This parser should not consume EOF
such that it can still be
combines with other parsers. Use parseIR
to parse an entire
input string instead.