You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Version 2.0 of the project represents a complete, from scratch rewrite of the project using the modular C syntax. The project is self-hosted meaning it is used to compile itself, but the generated .c.h and .mk files are left in the repository so that it can be built with a simple make.
Version 2.0 brings a number of enhancements over the original.
Unit Tests - Not nearly everything is covered yet, but they exist and get built by Travis
Better Lexer - Instead of using flex as the previous version did, this project uses a hand-coded lexer build after the style of Rob Pike's go template lexer.
Real Parser - The first version just abused the lexer's features to determine syntax it would try to parse. As a result, many syntax errors would be pass through without any feedback, and get caught by the C compiler. The new hand coded parser is much better at catching syntax errors, and can provide useful error messages.
Error Messages - Useful error messages for incorrect syntax.
The project probably works on all posix based systems. It has been tested on OSX, Linux, and FreeBSD.
Dependencies:
C compiler. # clang and gcc have been tested
make # Tested with GNU Make and BSD Make
to build, simply run:
make
sudo make install # if you want
this will generate the cbuild binary.
Usage:
cbuild [command] [options] <module>
Options:
-v verbose
Commands:
build generates source files and builds the module (default)
generate generates source files
clean clean all generated sources, object files, and executables
the module is the source for either an executable or library you would like to turn into a c project.
cbuild generates a .c and .h file for each module in the depencency tree of module. Furthermore it generates a
.mk file which specifies the depencencies between all the generated files and their respective objects, it also
contains a rule to build either a static library or an executable for modules where the name is main.
About
cbuild: builder / preprocessor for modular C syntax.