ReiLang is a simple, Python-inspired interpreted programming language built in Java. It supports basic constructs such as variable assignment, arithmetic operations, print statements, and conditional logic.
- Variable Assignment
- Arithmetic Operations (
+,-,*,/) - Print Statements
- If-Else Conditionals
git clone https://github.com/NamanRajput-git/ReiLang.git
cd rei_langEnsure you have Java 11+:
javac -d out src/rei/*.java
java -cp out rei.MainYou can write ReiLang programs using:
String source = String.join("\n",
"x = 10",
"y = 5",
"if x > y",
"print x",
"else",
"print y"
);Or, use Java 15+ text blocks:
String source = """
x = 10
y = 5
if x > y
print x
else
print y
""";Then interpret:
ReiLexer lexer = new ReiLexer(source);
List<Token> tokens = lexer.tokenize();
ReiParser parser = new ReiParser(tokens);
List<Stmt> stmts = parser.parse();
ReiInterpreter interpreter = new ReiInterpreter();
for (Stmt stmt : stmts) {
interpreter.execute(stmt);
}x = 10
y = x + 5a = 5 + 3
b = 10 - 2
c = 4 * 6
d = 20 / 4x = 10
print x
print 42
print x + 5x = 10
y = 5
if x > y
print xx = 3
y = 5
if x > y
print x
else
print yrei_lang/
├── rei/
│ ├── Expr.java
│ ├── Stmt.java
│ ├── ReiLexer.java
│ ├── ReiParser.java
│ ├── ReiInterpreter.java
│ ├── Token.java
│ └── TokenType.java
├── Main.java
- Loops (
while,for) - User-defined functions
- Code blocks and indentation
- Strings and input/output
Passionate about language design, compilers, and clean syntax, Naman developed ReiLang to explore how simple interpreted languages work under the hood — focusing on readability, expression parsing, and core logic constructs like arithmetic, variable assignments, printing, and conditional statements.
Contributions and suggestions are welcome!