A simple programming language with bilingual support (English & Arabic)
npm install amr-langA simple programming language with support for both English and Arabic keywords.
``bash`
npm install -g amr-lang
`bash`
npm install amr-lang
`bashRun a specific file
amr example.amr
amr test.amr
amr yourfile.amr
$3
`bash
Using npm scripts
npm start # Runs example.amr
amr myfile.amr # Runs any file
`Language Syntax
$3
`amr
let x : 10
let name : 5
خلي y : 20
`$3
`amr
show x
show x + 5
اطبع y
`$3
`amr
show 10 + 5 # Addition
show 10 - 5 # Subtraction
show 10 * 5 # Multiplication
show 10 / 5 # Division
`$3
`amr
show 10 > 5 # Greater than
show 5 < 10 # Less than
`$3
`amr
make add(a, b) {
return a + b
}show add(10, 20)
Arabic version
اعمل multiply(x, y) {
رجع x * y
}
`$3
`amr
let age : 18
when age > 17 {
show 1
}when age > 21 {
show 100
} otherwise {
show 0
}
Arabic version
لو age > 17 {
اطبع 1
} لولا {
اطبع 0
}
`$3
`amr
let counter : 5
loop counter > 0 {
show counter
let counter : counter - 1
}Arabic version
كرر counter > 0 {
اطبع counter
}
`$3
`amr
This is a comment
show 10 # Inline comment
`Keywords
$3
- let - Variable declaration
- show - Print output
- make - Function declaration
- return - Return from function
- when - If statement
- otherwise - Else statement
- loop - While loop$3
- خلي - Variable declaration (let)
- اطبع - Print output (show)
- اعمل - Function declaration (make)
- رجع - Return from function (return)
- لو - If statement (when)
- لولا - Else statement (otherwise)
- كرر - While loop (loop)Example Programs
$3
`amr
let x : 10
let y : 5show x + y
show x * y
`$3
`amr
make factorial(n) {
when n < 2 {
return 1
}
return n * factorial(n - 1)
}show factorial(5) # Output: 120
`$3
`amr
خلي x : 10
let y : 5اطبع x + y
show x * y
`Project Structure
`
My-Lang/
├── src/
│ ├── index.ts # Entry point
│ ├── lexer.ts # Tokenizer
│ ├── parser.ts # Parser
│ ├── interpreter.ts # Interpreter
│ ├── ast.ts # AST definitions
│ ├── environment.ts # Variable environment
│ └── run.ts # Runner
├── bin/
│ └── amr.js # CLI executable
├── example.amr # Example program
├── test.amr # Test program
└── package.json
`Development
`bash
Run in development mode
npm startRun a specific file
amr yourfile.amr
``✅ Variable declarations
✅ Arithmetic operations (+, -, *, /)
✅ Comparison operations (>, <)
✅ Function declarations and calls
✅ Conditional statements (if/else)
✅ While loops
✅ Comments
✅ Bilingual support (English & Arabic)
✅ Recursive functions
✅ Proper operator precedence
MIT
Amr Elsherbiny