cparsing: A simple C++ parser with preprocessor features. C++ refactorings included.

[ bsd3, language, library ] [ Propose Tags ]

A simple implementation of a C++ parser using Parsec. It is defined with a custom AST and parser. The basic idea was to create a C++ representation that keeps its connection with the original source code regardless of the preprocessor operations done on it. Each AST node that is expanded from a macro expansion records that fact and their transformations are constrained to protect the original structure of the program. A preprocessor implementation is given that tracks the macro expansions and this helps to create an AST where the nodes refer to the original source code from which they were generated. The MiniC module contains the entry point of the parser, the CTransform package provides a transformation of the AST. The C++ AST and parser and semantical analysis is defined in the MiniC package. Traversing utilities are defined in the Data package. General AST elements are defined in the SourceCode package. This is an early project of mine, the ideas behind this project are fully developed in the Haskell-Tools project. Regardless, this early experience led me to continue using this approach. By the way, this is an old project I am no longer developing.

Versions [faq]
Change log
Dependencies base (==4.10.*), containers (==0.5.*), directory (==1.3.*), either (==4.4.*), filepath (==1.4.*), HUnit (==1.6.*), lens (==4.15.*), mtl (==2.2.*), parsec (==3.1.*), split (==0.2.*), template-haskell (==2.12.*), transformers (==0.5.*) [details]
License BSD-3-Clause
Author Boldizsar Nemeth
Category Language
Uploaded by lazac at 2017-11-16T06:00:26Z
Distributions NixOS:
Downloads 724 total (4 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Hackage Matrix CI
Docs not available [build log]
All reported builds failed as of 2017-11-16 [all 3 reports]


  • CTransform
  • Data
    • Data.SmartTrav
      • Data.SmartTrav.Class
      • Data.SmartTrav.Example
      • Data.SmartTrav.Indexing
      • Data.SmartTrav.Instances
      • Data.SmartTrav.TH
  • MiniC
    • MiniC.AST
    • MiniC.GenTemplate
    • MiniC.Helpers
    • MiniC.Instances
    • MiniC.MiniCPP
    • MiniC.ParseProgram
    • MiniC.Parser
      • MiniC.Parser.Base
      • MiniC.Parser.Expr
      • MiniC.Parser.Lexical
    • MiniC.PrettyPrint
    • MiniC.RangeTree
    • MiniC.Representation
    • MiniC.Semantics
    • MiniC.SourceNotation
    • MiniC.SymbolTable
    • MiniC.TransformInfo
  • RemixC
  • SourceCode
    • SourceCode.ASTElems
    • SourceCode.ASTNode
    • SourceCode.Parsec
    • SourceCode.SourceInfo
    • SourceCode.SourceTree
    • SourceCode.ToSourceTree
  • Text
    • Parsec
      • Text.Parsec.ExtraCombinators
      • Text.Parsec.PosOps
    • Preprocess
      • Text.Preprocess.Helpers
      • Text.Preprocess.Parser
      • Text.Preprocess.Rewrites


Maintainer's Corner

For package maintainers and hackage trustees