devlang
Description
Welcome to our self-made compiler project! This compiler is developed using Prolog, Java, and Shell Script, designed to work seamlessly across MacOS, Windows, and Linux platforms. Our project walks you through the process of compiling and executing custom code effortlessly.
Check out our YouTube video for a comprehensive overview: Link to Our YouTube Video
Support
- Integer Operations
 - String Operations
 - Arithematic Operations
 - Assignment Operations
 - Boolean Operations
 - Print Statements
 - Conditional Statements
 - Loop Statements
 
devlang Is Turing Complete.
System Requirements
- MacOS
 - Windows
 - Linux
 
Installation
The compiler version is available on GitHub. Clone the repository and start using it!
git clone [URL]Usage
./devlang [path/to/code]Example Code
- Hello World
 
dev
{
    tout(charr("Hello world!")) 
}
lang- Arithematic Expression
 
dev{
    var x = int(7) ,
    var y = int(8) ,
    tout([ x + y]) ,
    tout([ x - y]) ,
    tout([ x * y]) ,
    tout([ x / y]) 
}lang- Boolean Expression Usage
 
dev{
    tout(and(bool(true) , bool(false))) ,
    tout(and(bool(true) , bool(true))) ,
    tout(or(bool(false) ,  bool(false))) ,
    tout(or(bool(true) , bool(false))) ,
    tout(not(bool(true))) ,
    tout(not(bool(false))) ,
    tout(int(5)>int(3)) ,
    tout(int(5)==int(5)) ,
    tout(int(5)<int(3)) 
}lang- Assignment Statements
 
dev
{
    var string = charr("hello") ,
    var b = bool(true) ,
   
    var x = [ int(5) + int(6) ] ,
    var x = [ int(5) - x ] ,
    
    
    tout( x ) ,
    tout ( b ) ,
    tout( string ) ,
    tout( charr("true") ) 
}
langBuild Compiler Locally
- Build Lexer (Java)
 
cd src/Lexer
javac -cp classes/antlr-runtime-4.13.1.jar CustomLanguageLexer.java
javac -cp "classes/antlr-runtime-4.13.1.jar:." Main.java
java -cp "classes/antlr-runtime-4.13.1.jar:." Main- Generate Parse Tree, And Execute
 
swipl -s src/parser/Parser.pl -g "procedure(T,[Tokens],R), write(T),halt."
swipl -s src/interpreter.pl -g "eval_procedure([Parsed Tree], R),halt."