Table of Contents
Carbonic-C is a lightweight imperative programming language with Pascal/Oberon-like syntax. The language supports a set of basic features you would find in any programming language, as well as some more complex ones. Below are some of the main characteristics of the language:
- The langugae is static. Object types are fixed at object declarations and cannot change during program execution.
- There are three predefined data types: integer, real, boolean.
- There are two predefined data structures: records, arrays.
- Full expression syntax with usual set of binary, logical, and comparison operators.
- The language is compiled,
LLVM
bytecode being the target. - The structure of the program is a sequence of data and routine (function)declarations.
- The language features a standard set of statements: Assignment, if, for, while, return, print.
Carbonic-C has a VS Code extension that offers syntax highlighting and auto-completion. You can check it out here
Below are the instructions for setting up the project locally on a Linux machine.
-
g++ 11.3.0
sudo apt install g++=11.3.0
-
flex 2.6.4
sudo apt install flex=2.6.4
-
bison 3.8.2
sudo apt install bison=3.8.2
-
make 4.3
sudo apt install make=4.3
-
cmake 3.26.0
sudo apt install cmake=2.6.4
-
llvm 14.0.0
sudo apt install llvm-14
The project uses CMake
as a build tool and contains a Makefile
to provide an interface to easily use it. Below is the list of commands and their corresponding functionalities. These commands are available directly in the source directory.
run
: Runs the compiler in the terminal and expects input fromstdin
. Prints output tostdout
. This can be used as the "default' command for running the compiler, and is the quickest way to do so.
make run
run/file
: Compiles the contents of theinput.crbc
file in the source directory and produces output tooutput.out
also in the source directory.
make run/file
test
: Runs a large set of valid/invalid Unit and End-to-End tests that test the entire compiler as well as its individual components and features. The test suite is run usingCTest
and prints elaborate output and test stats to the terminal.
make test
build
: If not previously built, this command will build the compiler in all of its stages and produce a single executable file. All generated files can be found incarbonic-c/build
. If previously built, this command will build partially (re-compiling only files that have been touched since last built). This should be used as the default command for building the project after any changes are made.
make build
clean
: Removes all previously generated build and output files. This command can be used to restore the project to its "default" state
make clean
build/all
: Runsclean
, removing all previously generated files and resetting the project, after that it builds the project from scratch with all of its components.
make build/all
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the 3-Clause BSD License. See LICENSE.txt
for more information.