A web-based playground and compiler for a custom programming language with Hindi-inspired keywords (definekar, agar, warna).
- Online REPL - Write and run code directly in your browser
- Code Viewer - View, run, and download example programs
- Language Learning - Tutorial and documentation for the custom language
- Windows Executable - Download
om.exeto run.omfiles locally - GitHub Integration - Direct link to the source code repository
Visit the web REPL and learn the language at the homepage.
definekar x = 10;
agar (x > 5) {
x
} warna {
0
}
-
Build the Docker image:
docker build -t interpreter-app . -
Run the container:
docker run -p 5000:5000 interpreter-app
-
Open your browser at: http://localhost:5000
The Windows executable (om.exe) is automatically generated during the Docker build process.
- Go to the homepage in the web app
- Click "Download om.exe" in the "Run Locally" section
- Save the file and run:
om.exe filename.om
om.exe filename.omExample:
om.exe factorial.om- Go 1.21+
- Python 3.7+ with Flask
-
Build the Go interpreter:
go build -o main.exe main.go
-
Build the Windows executable:
GOOS=windows GOARCH=amd64 CGO_ENABLED=0 go build -o om.exe main.go
-
Install Flask:
pip install Flask
-
Run the Flask app:
cd frontend python app.py
The language uses Hindi-inspired keywords:
definekar- Variable declaration (instead oflet)agar- If statement (instead ofif)warna- Else statement (instead ofelse)fn- Function definitionreturn- Return statement
len(array)- Get array lengthfirst(array)- Get first elementlast(array)- Get last elementrest(array)- Get all elements except firstpush(array, value)- Add element to arrayputs(value)- Print valueindex(array, i)- Get element at index
View the source code and contribute: https://github.com/Omkumar2003/Interpreter
A custom programming language interpreter built in Go with a web-based frontend for easy experimentation and learning.
This includes building a lexer, parser, abstract syntax tree representation,macro and an evaluator. The primary objective is to create a fully functional interpreter for "Om" language , exclusively developed within the scope of this project.For building this projrct i took refrence from this book https://interpreterbook.com/ Writing An Interpreter In Go by Thorsten Ball
prerequisite:install golang- open terminal
- type 'go run main.go'
- make sure your file extension ends with .om
- to run file code ,open terminal and run 'go run main.go fileLocation' replace fileLoaction with actual file you want to run
-
let a = 120 ;
let b = "hello world" ;
let c = [12 , 13 , 14] ;
let d = [21 , 41 , 58 , "hello world"] ;
let e = [1, 2 * 2, 10 - 5, 8 / 2];
-
let add = fn(a, b) { a + b };
let add = fn(a, b) { a + b };
let sub = fn(a, b) { a - b };
let applyFunc = fn(a, b, func) { func(a, b) };
-
puts is like print
let a = 10 ;
puts(a);
puts(10 * 20 / 45 -50); -
first gives first element of the array.
first(array_name);
last gives last element of the array.
last(array_name);
rest gives all element of the array other than first.
rest(array_name);
rest(rest(rest(rest(rest(a)))))
push appends element to the array.
push(array_name, element);
index gives the element of the array at current index.
index(array_name, index_number);
-
let reverse = macro(a, b) { quote(unquote(b) - unquote(a)); };
reverse(2 + 2, 10 - 5);
-
let people = [{"name": "Alice", "age": 24}, {"name": "Anna", "age": 28}];
people[0]["name"];