Skip to content

Ayush2006128/pyoxide

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pyoxide

A lightweight expression language interpreter written in Rust.

Features

  • Arithmetic expressions with +, -, *, /
  • Variable assignment
  • Parentheses for grouping
  • Interactive REPL
  • File execution mode

Installation

cargo build --release

Usage

REPL Mode

Run without arguments to enter the interactive interpreter:

cargo run

Example session:

> x = 10
> y = 20
> x + y
30
> (x + y) * 2
60

File Mode

Run a .pyoxide file:

cargo run -- example.pyoxide

Example example.pyoxide:

radius = 5
area = 3.14 * radius * radius
area

Language Syntax

# Variable assignment
x = 10

# Expressions
y = x + 5        # addition
z = y - 3        # subtraction
result = z * 2   # multiplication
frac = result / 4  # division

# Parentheses
value = (x + y) * (z - 1)

# Print by evaluating
x + y

Architecture

Lexer  -->  Parser  -->  Interpreter
  • Lexer: Tokenizes input source code
  • Parser: Builds AST from tokens
  • Interpreter: Evaluates expressions

License

MIT

About

A performant interpreter for python

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages