morley-1.20.0: Developer tools for the Michelson Language
Safe HaskellSafe-Inferred
LanguageHaskell2010

Morley.Michelson.Parser.Macro

Description

Parsing of built-in Michelson macros.

Synopsis

Documentation

allMacros :: Parser (ParsedSeq ParsedOp) -> Parser Macro Source #

Includes all macros, also the specially-handled ones. Macros are allowed in more contexts than instructions, so sometimes it's unambiguous.

Notably DUUP and DIIP are excluded, as they're always represented by a single instruction and thus behave more like a primitive.

allSingleTokenMacros :: Parser Macro Source #

This includes all macros consisting of a single token, i.e. also the specially-handled ones, like PAIIR, CADR, etc, but not DUUP, as it's always represented as DUPN and thus behaves like a primitive.

These are handled separately to have better error messages

diipMac :: Parser [ParsedOp] -> Parser Macro Source #

This might look strange, but at the time of writing, reference implementation requires braced argument to DIIP, even if the argument is a macro. Thus, DIP 2 FAIL is fine, but DIIP FAIL is a syntax error.