Behenlang is a toy programming langauge inspired from Bhailang.
You need llvmlite and sly modules to run the project.
-
llvmlite
pip install llvmlite
-
sly
pip install sly
Extention for behenlang is .behen , to compile .behen files use
python run.py <filename.behen>
This will generate a .ll intermediate code file in the same folder where code is present and output the result too.
kaam
is used to define a function. One must define main
function in the project. Example :
kaam int main() {
# code goes here
behen bhejo 0 #similar to return
}
behen
or didi
is used to initialize any statement.
behen bolo()
or didi bolo()
is used to print the strings :
kaam int main() {
didi bolo("Namste Duniya \n")
behen bolo("Hello World") #this is comment
behen bhejo 0
}
kaam int main() {
behen x=5
behen y=9.0
behen bhejo 0
}
kaam int main() {
behen num1 = 18
behen rem = num1 % 2
behen agar rem == 0{
behen bolo('Even')
}
warna{
behen bolo('Odd')
}
behen bhejo 0
}
kaam int main(){
behen i = 0
jabtak i < 10
{
didi bolo('Hello ')
didi i = i+1
}
didi bhejo 0
}
kaam int hello() {
behen bolo("Ye hai hello function\n")
behen bhejo 0
}
kaam int main(){
hello()
behen bolo("Ye hai main fun")
behen bhejo 0
}
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". Dont 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
- https://school.geekwall.in/p/Byz8Rg0GX
- https://llvmlite.readthedocs.io/en/latest/
- https://sly.readthedocs.io/en/latest/sly.html #documentation enough to make lexer and parser. Can use other libs like rply too
- https://groups.seas.harvard.edu/courses/cs153/2019fa/llvmlite.html
- https://buildmedia.readthedocs.org/media/pdf/llvmlite/latest/llvmlite.pdf
- https://github.com/topics/llvmlite #reference from many projectes which used llvmlite