A language inspired by the darija moroccan dialect
# This is a project for the Language Theory class taught by Professor Youness Moukafih
# DarijaLang: A Comprehensive Guide
DarijaLang is a compiled programming language with syntax inspired by Darija, the Arabic dialect spoken in Morocco. It combines traditional programming constructs with culturally-relevant keywords to create a unique language that serves both as an educational tool and a practical programming language.
## Table of Contents
1. Introduction
2. Compiler Architecture
3. Lexical Analysis
4. Syntax Analysis
5. Intermediate Representation
6. Code Generation
7. Runtime Support
8. Language Features
9. Error Handling
10. Testing and Development
11. Usage Guide
## Introduction
The DarijaLang compiler translates source code into C, which is then compiled to machine code using a standard C compiler (gcc/clang). This approach, known as source-to-source compilation or "transpilation," allows DarijaLang to leverage the optimization capabilities and cross-platform support of existing C compilers while maintaining its own unique syntax and features.
### Key Features
- **Culturally-relevant keywords**: Control structures and concepts use Darija-based terminology
- Example: `ila` (if), `awla` (else), `mnintchouf` (while), `koulla` (for), `7awl` (try), `chd` (catch)
- **C-like core syntax**: Familiar programming paradigm with enhanced readability
- **Strong type system**: Static typing with clear type declarations
- Supported types: `int`, `float`, `string`, `bool`, and others
- **Rich control flow**: If/else statements, loops, and functions
- **Error handling**: Try-catch-throw mechanism using culturally-relevant keywords (7awl/chd/lou7)
- **Data structures**: Support for arrays and dictionaries
- **Object-oriented features**: Classes, inheritance, and access modifiers (m3rof/mkhabi)
### Example: Hello World in DarijaLang
```
tba3("Salam Darija!");
```
### Example: Variable Declaration and Control Flow
```
int x = 10;
string name = "Ahmed";
ila (x > 5) { …