Skip to content

CsqLang/Csq3

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Csq-Version3

This is one more version of Csq programming language which's syntax looks much similar to Python and much faster than Csq Version-2.

Requirement

You should have g++ compiler

How does it works in backend?

It's processes are similar to the in the programming language Nim but here what it does it that a Intermediate code converter converts .csq to .csqm and later .csqm is converted to .cpp and it uses a prebuilt C++ compiler such as in this it uses clang++ to produce output.

What is new?

  • Speed is made faster than Csq version-2.
  • Functions can be used in main file.
  • Syntax for for loop is enhanced.
  • Speed of imported module is faster.
  • Code of CsqV2 couldn't be used in this.
  • You could add new tokens to it by changing base/token.h.
  • How to build Csq?

  • git clone https://github.com/CsqLang/Csq3
  • cd Csq-Version3 && bash build.sh
  • Some examples:

    Hello World

    print("Hello World")

    Creating Variables

    var i = 48
    //int i = 48 //But if you want to define a str so don't write like var v = "hello" because in this case it's considered as const char* use var v = str("hello")

    if else if and else

    if condition so ..... ends else if condition so ..... ends else go ..... ends

    For loop

    for var i : range(11)
     print(i,",")
    ends

    Functions

    def fizz()
     return str("BUZZ")
    fizz ends

    Functions with arguments

    def fizz(str name)
     return name + " BUZZ"
    fizz ends
    fizz("Aniket")

    Language used in backend

    Csq uses C++ at backend to compiler IR codes to generate machine code.

    New keywords::

    ["priv","pub","ends","meth"]

    To comment

    to comment you could use //

    What's inside base directory?

    In base directory all necessary header are present such as for code analysis, strings, arrays ...

    How to change add or remove operators:

    Go to base/token.h and there you will see a dictionary in which operators with their meaning in C++ are there. After changes compile csq.cpp and mcsq.cpp so that the changes can be applied.

    How it will provide memory safety if garbage collector isn't there?

    Well to provide memory safety there is one class which applies the concept of Smart Pointers using this it will free the memory by it self.

    About

    No description or website provided.

    Topics

    Resources

    License

    Stars

    Watchers

    Forks

    Releases

    No releases published

    Packages

    No packages published