Cparser

Jul 20, 2023

C99 compiler using libFIRM as backend

cparser is a recursive descent C99 parser written in C99. It contains lexer, parser, constructs an AST and does semantic analysis. It is currently used as a frontend to the libFirm intermediate representation, but can be used independently. cparser is able to bootstrap itself. It currently uses an external preprocessor.

  • fast recursive descent parser, parses C90 and C99
  • handles most GCC extensions, e.g. attribute, inline assembler, computed goto, statement expressions
  • handles some MSVC extensions like declspec
  • provides many useful warnings
    • format string checker for char and wchar_t
    • unreachable code analysis
    • missing return statement check, which pinpoints exact locations
    • write-only/-self variables detection
    • missing and redundant forward declarations
    • most warnings switches, which are available for GCC
  • provides concise messages in case of error, for example when encountering misspelled typenames
  • compiler driver compatible with GCC -fxxx, -Wxxx, -M, …
  • uses libFIRM for optimization and code generation devel/libfirm


Checkout these related ports:
  • Zig - Language designed for robustness, optimality, and maintainability
  • Zephir - Zephir is a transpiled language used for creating C-extensions for PHP
  • Ypsilon - Scheme implementation for real-time applications
  • Yorick - Interpreted language for scientific simulations
  • Yap - High-performance Prolog compiler
  • Yap-devel - High-performance Prolog compiler
  • Yabasic - Yet another Basic for Unix and Windows
  • Voc - Vishap Oberon Compiler for Oberon-2
  • Vala - Programming language and compiler that converts Vala code into C code
  • V8 - Open source JavaScript engine by Google
  • V8-beta - Open source JavaScript engine by Google
  • V - V Programming Language
  • Urweb - Ultimate host for embedded domain-specific languages
  • Ucc - C Compiler Which Implements the ANSI C89 Standard
  • Twelf - Meta-logical framework for deductive systems