Welcome to the repository of my custom programming language! This project is a personal endeavor to learn and explore the C programming language (hence the name is C + Sach) by developing an interpreter to create a new programming language. Inspired by Ianertson's YouTube tutorials, this project serves a way for me to learn C in a creative way.
This project is designed to help me (and potentially others) learn the fundamentals of the C programming language by building a new programming language. It provides a hands-on approach to understanding compiler design, syntax parsing, and other core concepts of programming languages.
- Variable Declaration and Printing: You can create variables, change their values, and output them.
- Function Declaration and Calling: You can create your own functions with custom arguments and call them in their scope.
- Variable types: Long integers, strings, characters, and booleans with explicit type annotations.
- Math: You can use integers. Basic math features are implemented. Other than parentheses, the order of operations is respected.
Before you begin, ensure you have met the following requirements:
- You have a C compiler installed (
gcc
orclang
). - You have
make
installed. - You have
sudo
installed for Unix-like systems.
Unix-like Systems (Linux, macOS)
-
Clone the repository
git clone https://github.com/sachkeeratb/CSach.git
-
Navigate to the project directory
cd CSach
-
Compile the project
a) Locallymake
or
b) System-wide
sudo make install
-
Run the interpreter
a) With local use./csach.out <filePath>
or
b) With system-wide use
csach <filePath>
-
The optional step to uninstall
a) Locallycd .. rm -rf CSach
or
b) System-wide
sudo make uninstall
or
c) System-wide without the CSach Makefile
sudo rm /usr/local/bin/csach
Windows
TODO
Here's an example of how to use the current features
let greeting = "Hello, " + "world!";
let a: int = 2 + 2 * 3 + 2 / 2 + 4^2;
func main() {
println(greeting);
let statement = "Nice to meet you!";
println(statement);
println();
print("The value of a is", a, "and that's cool!");
};
main();
Output:
Hello, world!
Nice to meet you!
The value of a is 25 and that's cool!
Special thanks to Ianertson for the amazing tutorial series on YouTube and his GitHub Repository that inspired this project.