[Haskell-cafe] Looking for simple C statements parser for Parsec, MegaParsec or Happy

Bulat Ziganshin bulat.ziganshin at gmail.com
Wed Jun 20 15:09:59 UTC 2018


Hello all,

I  develop  a preprocessor transpiling subset of C statements into gcc
_asm statements. For this project, I will be happy to reuse existing C
statements parser written with any popular Haskell technology, or just
start  with  some  simple  C  subset parser  in order to avoid redoing
existing work.

Unfortunately,  so far I found grammars just for everything but C. And
while  I  can  start  with  Parsec grammars for Java/Go, it seems that
MegaParsec now is better choice?

I  can  quickly  develop  grammar for small C subset, but ready-to-use
grammar  for  larger  C  subset  will  allow me to completely skip the
development  of  C statement parser and focus on the meat of project -
asm code generation.   

Eventually,  it may turn into LLVM pass transpiling parts of C++ code,
but  for  quick  prototype, I prefer Haskell, especially if I can find
ready-to-use parser.

PS:   It  was  the  first  time  I ever asked at SO, but it turned out
to be offtopic there:
https://stackoverflow.com/questions/50949118/simple-c-grammar-for-haskell-parsec-megaparsec-or-happy 

-- 
Best regards,
 Bulat                          mailto:Bulat.Ziganshin at gmail.com



More information about the Haskell-Cafe mailing list