Skip to content

vanshsuri1/CSuri

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CSach

Sachkeerat Singh Brar's Custom Programming Language

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.

Table of Contents

Introduction

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.

Features

  • 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.

Getting Started

Prerequisites

Before you begin, ensure you have met the following requirements:

  • You have a C compiler installed (gcc or clang).
  • You have make installed.
  • You have sudo installed for Unix-like systems.

Usage

Unix-like Systems (Linux, macOS)

  1. Clone the repository

    git clone https://github.com/sachkeeratb/CSach.git
  2. Navigate to the project directory

    cd CSach
  3. Compile the project
    a) Locally

    make

    or

    b) System-wide

    sudo make install
  4. Run the interpreter
    a) With local use

    ./csach.out <filePath>

    or

    b) With system-wide use

    csach <filePath>
  5. The optional step to uninstall
    a) Locally

    cd ..
    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

Examples

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!

Acknowledgements

Special thanks to Ianertson for the amazing tutorial series on YouTube and his GitHub Repository that inspired this project.

About

Learning C by creating my own programming language as an inspiration

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 98.4%
  • Makefile 1.6%