ottparse-pretty 0.1 → 0.1.1
raw patch · 3 files changed
+66/−8 lines, 3 files
Files
- CHANGES +8/−0
- ottparse-pretty.cabal +2/−1
- src/ottparse-pretty.hs +56/−7
+ CHANGES view
@@ -0,0 +1,8 @@+* 0.1: 11 October 2011++ Initial release++* 0.1.1: 11 October 2011++ - single quotes are allowed in identifiers+ - add example to documentation
ottparse-pretty.cabal view
@@ -1,5 +1,5 @@ Name: ottparse-pretty-Version: 0.1+Version: 0.1.1 Synopsis: Pretty-printer for Ott parse trees Description: Ott (<http://www.cl.cam.ac.uk/~pes20/ott/>) is a tool for writing formal definitions of programming@@ -17,6 +17,7 @@ meaningless cruft removed. License: BSD3 License-file: LICENSE+Extra-source-files: CHANGES Author: Brent Yorgey Maintainer: byorgey@cis.upenn.edu Category: Text
src/ottparse-pretty.hs view
@@ -8,13 +8,62 @@ -- -- Ott (<http://www.cl.cam.ac.uk/~pes20/ott/>) is a tool for writing -- formal definitions of programming languages and calculi. Often the--- Ott grammars one defines end up being ambiguous, and Ott signals ---its displeasure by spewing forth several massive parse trees in a ---format requiring formidable patience to read. Finding the slight ---differences between two such parse trees is an exercise in ---seizure-inducing tedium. -- -- To the rescue comes ottparse-pretty!-Simply paste in each parse -- and it is shown to you in a nicely- formatted tree form with all the -- extra meaningless cruft removed.+-- Ott grammars one defines end up being ambiguous, and Ott signals+-- its displeasure by spewing forth several massive parse trees in a+-- format requiring formidable patience to read. Finding the slight+-- differences between two such parse trees is an exercise in+-- seizure-inducing tedium.+--+-- To the rescue comes ottparse-pretty! Simply paste in each parse+-- and it is shown to you in a nicely formatted tree form with all the+-- extra meaningless cruft removed.+--+-- For example, it turns this:+--+-- @+-- (St_node :formula:formula_judgement: (Ste_st (St_node :judgement:judgement_Jtype: (Ste_st (St_node :Jtype:coerce: (Ste_st (St_nonterm G)) (Ste_st (St_nonterm g)) (Ste_st (St_node :s:T_MultiTypeApp: (Ste_st (St_node :s:T_EqTy: (Ste_st (St_node :s:T_MultiTypeApp: (Ste_st (St_node :s:T_MultiKindApp: (Ste_st (St_node :s:T_Cons: (Ste_st (St_nonterm H)))) (Ste_st (St_nonterm k)))) (Ste_st (St_nonterm t)))) (Ste_st (St_node :s:T_MultiKindApp: (Ste_st (St_node :s:T_Cons: (Ste_st (St_nonterm H)))) (Ste_st (St_nonterm k)))))) (Ste_st (St_nonterm t')))))))))+-- @+--+-- into this:+--+-- @+-- formula_judgement+-- |+-- `- judgement_Jtype+-- |+-- `- coerce+-- |+-- +- G+-- |+-- +- g+-- |+-- `- T_MultiTypeApp+-- |+-- +- T_EqTy+-- | |+-- | +- T_MultiTypeApp+-- | | |+-- | | +- T_MultiKindApp+-- | | | |+-- | | | +- T_Cons+-- | | | | |+-- | | | | `- H+-- | | | |+-- | | | `- k+-- | | |+-- | | `- t+-- | |+-- | `- T_MultiKindApp+-- | |+-- | +- T_Cons+-- | | |+-- | | `- H+-- | |+-- | `- k+-- |+-- `- t'+-- @+-- ----------------------------------------------------------------------------- import Text.Ott.Pretty