platinum-parsing-0.1.0.0: General Framework for compiler development.

Copyright(c) 2017 Patrick Champion
Licensesee LICENSE file
Maintainerchlablak@gmail.com
Stabilityprovisional
Portabilityportable
Safe HaskellSafe
LanguageHaskell2010

PP.Grammar

Description

 

Synopsis

Documentation

type To ast = Either ParseError ast Source #

Syntactic sugar For exemple: `case PP.parseAst input :: (PP.To Ebnf.Syntax) of ...`

class (Eq ast, Show ast) => InputGrammar ast where Source #

Type class for grammars

Minimal complete definition

parser, rules

Methods

parser :: Parsec String () ast Source #

Entry parser

parseAst :: String -> To ast Source #

Parse String to AST

stringify :: ast -> String Source #

AST to String

rules :: ast -> [Rule] Source #

AST to canonical rules

lexify :: ast -> ast Source #

Transform terminals to lexical rules

Instances

InputGrammar RegExpr Source #

RegExpr InputGrammar instance

InputGrammar LexicalDefinition Source # 
InputGrammar LexicalDefinitionList Source # 
InputGrammar LexicalRule Source # 
InputGrammar MetaIdentifier Source # 
InputGrammar Primary Source # 
InputGrammar Factor Source # 
InputGrammar Exception Source # 
InputGrammar Term Source # 
InputGrammar SingleDefinition Source # 
InputGrammar DefinitionsList Source # 
InputGrammar SyntaxRule Source # 
InputGrammar Syntax Source # 

rules' :: InputGrammar ast => ast -> IO (Either String [Rule]) Source #

Exception-safe version of rules