A web-based compiler that translates code written in a simple custom programming language into multiple target programming languages (JavaScript, Python, C++, Java, and C).
-
Simple Custom Language Syntax:
maano
- Variable declarationlikho
- Print statementagar
- If conditionwarna
- Else statementjabtak
- While loop
-
Multi-Language Support:
- JavaScript (with live execution)
- Python
- C++
- Java
- C
-
Interactive Web Interface:
- Real-time code conversion
- Live output for JavaScript execution
- Syntax highlighting
- Modern, responsive design
Here are some examples of how to use the custom language:
maano x = 5
likho x
maano first = 10
maano second = 20
maano sum = first + second
likho "Sum of two numbers is:"
likho sum
maano x = 5
maano y = 10
agar x < y {
likho "x is less than y"
} warna {
likho "x is greater than or equal to y"
}
- Open
index1.html
in a web browser - Write your code in the custom language syntax in the textarea
- Select your target programming language from the dropdown
- Click "Run Code" to:
- See the converted code in your chosen programming language
- See the output (if JavaScript is selected)
index1.html
- The main web interfacescript.js
- Contains the compiler implementation (lexer, parser, and code generator)styles.css
- CSS styling for the web interface
The compiler works in three main stages:
-
Lexical Analysis (Lexer):
- Breaks down input code into tokens
- Identifies keywords, identifiers, numbers, and operators
-
Syntax Analysis (Parser):
- Converts tokens into an Abstract Syntax Tree (AST)
- Validates the program structure
-
Code Generation:
- Converts the AST into target programming language code
- Handles language-specific syntax and features
The compiler works in all modern web browsers:
- Google Chrome
- Mozilla Firefox
- Microsoft Edge
- Safari
- JavaScript mode provides live execution in the browser
- For other languages, the compiler generates equivalent code that can be run in their respective environments
- The project uses a clean, minimalist design with a matrix-inspired background