Skip to content

ComPy-Lang is a new compiled programming language, designed to target the domain of ‘Scientific Computing’. ComPy supports simple syntax and provides adequate performance compared to other similar languages. The ComPy compiler is an ‘ahead-of-time’ compiler.

License

Notifications You must be signed in to change notification settings

ComPy-Lang/ComPy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

91 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ComPy

ComPy-Lang is a new domain-specific programming language, which has been designed to help the community of Scientific Computing. ComPy-Lang comes with features like simple and understandable syntax, better performance than similar languages, and easy-to-understand error messages. It will provide all the required optimizations for numeric computations (using libasr). The ComPy compiler is an Ahead-of-time compiler. It is designed using the tools that are made for programming languages with a focus on speedy compilation and generating fast code. ComPy also includes runtime libraries to assist in numerical computations.

Installation

ComPy works on Linux and MacOS.

Install Conda

If you do not have Conda already installed, please follow the instructions here to install Conda for your platform:

https://github.com/conda-forge/miniforge/#unix-like-platforms

Install other required packages (Linux 64-bit), If already installed, continue:

sudo apt install binutils-dev zlib1g-dev

To compile ComPy, follow the instructions

Create a Conda environment:

conda create -n cp llvmdev=11.0.1 bison=3.4 re2c python cmake make toml numpy
conda activate cp

To get the latest changes, clone from GitHub:

git clone https://github.com/ComPy-Lang/ComPy.git
cd ComPy

Create autogenerated files:

./build0.sh

Compile ComPy:

cmake -DCMAKE_BUILD_TYPE=Debug -DWITH_LLVM=yes -DWITH_STACKTRACE=yes -DWITH_LFORTRAN_BINARY_MODFILES=no .
cmake --build . -j16

To check the version:

./src/bin/compy --version

To check the supported options:

./src/bin/compy --help

To test the tokens:

./src/bin/compy --show-tokens --indent example/ex_01.cp

To test the Abstract Syntax Tree:

./src/bin/compy --show-ast --indent example/ex_01.cp

To test the Abstract Semantic Representation:

./src/bin/compy --show-asr --indent example/ex_01.cp

To test the LLVM:

./src/bin/compy --show-llvm --indent example/ex_01.cp

To Compile the file using ComPy:

$ cat example/ex_01.cp
def main():
    x: i32
    x = 10 + 20
    print(x)

main()
$ ./src/bin/compy example/ex_01.cp
$ ./a.out
30

About

ComPy-Lang is a new compiled programming language, designed to target the domain of ‘Scientific Computing’. ComPy supports simple syntax and provides adequate performance compared to other similar languages. The ComPy compiler is an ‘ahead-of-time’ compiler.

Resources

License

Stars

Watchers

Forks

Packages

No packages published