~groovestomp/c-parser

GrooveStomp's C Language Parser
65e17356 — Aaron Oman 2 years ago
Massive update that fixes parse tree generation
1e5d53f2 — Aaron Oman 2 years ago
Fix #define ordering
28d79988 — Aaron Oman 2 years ago
Re-indent parser.c

refs

master
browse  log 

clone

read-only
https://git.sr.ht/~groovestomp/c-parser
read/write
git@git.sr.ht:~groovestomp/c-parser

You can also use your local clone with git send-email.

#C Parser

#Motivation

Provide a library to interact with C source code. This might include writing a full-blown compiler, building a language server, or manipulating source code, integrating with an IDE, better debugging facilities, or any of a number of other possibilities.

#Caveats

Only tested in Linux.

There is no support for the C preprocessor at all. Any preprocessor commands are simply ignored, as are comments.

The parser does parse some C programs, like the provided sample.c.

#Dependencies

  • gcc This is explicitly invoked in the Makefile, but I also test with tcc and pcc.

  • posix-compliant shell

#Build

These commands output an executable named cparser

$ make debug
$ make release

Other targets:

$ make test # Build test executable
$ make help # Show this help on the CLI