Mix and match your favorite grammar fragments and aspects to customize your own markup translator!
markupconverter is an extensible Haskell library for converting markup language formats.
To translate from language A to B, we need two things:
-
Grammar fragments to describe the parser for language A, that parses a document into a general document datatype.
-
Aspects to describe the process of converting the general document datatype to a document in language B.
To build the translator, we write
translAB = buildTranslator grammarA aspectsB
Both grammar fragments and aspects are first class Haskell values that can be imported, manipulated and exported again. For example:
translAB' = buildTranslator (grammarA +>> myGramExtension) (aspectsB .+. myNewAspect .+. anotherAspect)
By using the murder library, we can describe parsers by writing context free grammars