Giter Club home page Giter Club logo

beluga's Introduction

beluga: a standard C compiler

beluga is a standard C compiler being developed based on lcc. It supports C90 (to be precise, ISO/IEC 9899:1990) as its ancestor does and is planned to extend the coverage to C99 (and C11 finally).

Compared to its parent, it carefully implements the language standard and thus provides production-quality diagnostics. The generated code is not highly optimized, but satisfactory enough to use beluga in daily programming. (This is a hobby project; never easy for me alone to catch up production compilers like gcc and clang+llvm.)

beluga currently produces assembly output for x86 only (and uses an assembler from the target system). Thanks to its origin, however, it can be readily retargeted to other platforms. Support for 64-bit machines (like x86-64) requires new significant features to be implemented and is one of most important goals of this project.

Also I'm redesigning each part of the compiler aiming for better structure and have a plan to completely replace the back-end interface and implementation to ease adoptation of more ambitious optimization techniques mainly based on a CFG.

A C preprocessor, sea-canary

An accompanying standard C preprocessor sea-canary is carefully designed and implemented from scratch to support beluga. It is fairly fast, is correct enough to pass many complicated test cases, produces highly compact output and has rich diagnostics. For example, it catches code that subtly depends on an unspecified evaluation order of the ## operator like this:

#define concat(x, y, z) x ## y ## z
concat(3.14e, -, f)    /* non-portable */

and cleverly keeps track of macro expansions whose recursiveness is determined by an implementation rather than by the standard:

#define f(a) a*g
#define g(a) f(a)
f(2)(9)    /* non-portable */

(see the defect report #017 for the latter example). The current version of sea-canary supports C90, thus some features like variadic macros introduced in C99 and widely used now are not supported yet.

Try it out

You can try them out on the beluga's web page.

How to install

INSTALL.md explains how to build and install the libraries. For the copyright issues, see the accompanying LICENSE.md file.

Contact

If you have a question or suggestion, do not hesitate to contact me via email (woong.jun at gmail.com) or web (http://code.woong.org/).

beluga's People

Contributors

mycoboco avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.