Skip to content

Pyr0de/pod-interpreter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Written in Go!

Example:

let a = 10;
let b = 12;
if a == 10 {
    print a;
}else if b == 12 {
    print a+b;
}else {
    print 0;
}

Prerequsites

  • go (>=1.22.2)
  • python3
  • bash

Build

./run build
# Wasm
./run build wasm

Usage

Native Executable can be found in ./out

RUN_TYPE={interpreter-arg} ./run {script-args} {.pod file} 
# OR
./out/pod-interpreter {interpreter-arg} {.pod file}

Interpreter Arguments

  • tokenize
  • parse (parse expression)
  • evaluate (evaluate expression)
  • run (run program)

Script Arguments (not set by default)

  • build: builds for selected target
  • wasm: sets target to WASM
  • test: Runs tests
  • bless: (only with test) saves state of stdout & stderr for future testing

Web server starts at localhost:8080. Web interpreter files can be found in ./out

# Wasm (server at localhost:8080)
./run wasm

To-Do

  • Tokenizer
  • Parser
  • Expression Evaluator
  • Variable
  • Print
  • If statement
  • While loop
  • For loop
  • Functions
  • Function Arguments
  • Return
  • File read/write
  • Stdin
  • Stdlib
  • Testing

References

Operators

+, -, *, /, ^, %, ==, !=, >, >=, <, <=, &&, ||

Function

func, return

Initialize

let

If and loops

if, else, for, while

Data types

string, int, float, true/false

Other

;, (, ), {, }

About

An Interpreter written in Go for Pod

Topics

Resources

Stars

Watchers

Forks