Welcome to the official repository of the LughatDad project; a general-purpose Arabic programming language with its own custom compiler built using JavaCC. This project allows users to write, compile, and execute Arabic source code in real-time through an interactive web interface.
The project has recently been upgraded to follow an industry-standard decoupled architecture, ensuring fast performance and making the compiler freely accessible online:
- Frontend:
- Built using
HTML,CSS, andVanilla JavaScript. - Hosted on [GitHub Pages] to provide fast access and a stable, interactive user interface.
- Built using
- Backend & Compiler:
- The core compiler is built in Java using the JavaCC parser generator.
- Wrapped in a lightweight Python server that handles code execution via a RESTful API.
- Fully containerized using Docker and hosted on Hugging Face Spaces as a cloud server running on port
7860.
- Arabic Syntax: Full support for variables, loops (
بينما/ while), conditional statements (إذا/ if), and print operations written entirely in Arabic. - Cloud Execution: Code is sent from the browser to the Hugging Face server, compiled and executed in a Java environment, and results (or errors) are returned to the user instantly.
- Isolated & Secure: Code is executed in temporary files that are immediately deleted after the output is returned.
When a user clicks "Run Code" on the web interface:
JavaScriptcaptures the input text and sends aPOSTrequest to the Python server (Hugging Face API).- The
Pythonserver creates a temporary text file containing the LughatDad source code. - The
Javacompiler is invoked via asubprocesscommand, passing the temporary file as an argument. - The compiler reads, parses (Lexical & Syntax Analysis), and executes the code.
- The
Pythonserver returns the standard output (or error messages) formatted as aJSONresponse back to the frontend.
If you want to modify the compiler or run it locally on your machine:
- Java (JDK)
- Python 3
- JavaCC (Downloaded automatically by the build script)
Step 1: Clone the repository and navigate into it
git clone https://github.com/Yazeed70/Arabic-General-Purpose-Language-Compiler.git
cd Arabic-General-Purpose-Language-CompilerStep 2: Build the compiler and start the local server
run_web.batStep 3: Open your browser and navigate to
http://localhost:8000
If you have Docker installed, you can build and spin up the entire project environment easily:
docker build -t lughatdad-compiler .
docker run -p 8000:7860 lughatdad-compiler- Lexer & Parser: JavaCC
- Backend: Python (BaseHTTPRequestHandler)
- Frontend: Vanilla JS, HTML, CSS
- Containerization: Docker
- Hosting: GitHub Pages (Frontend) | Hugging Face Spaces (Backend)
This project was developed as part of the practical coursework for the Compilers course.