Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

ASteinheiser/amoeba-interpreter

Repository files navigation

Amoeba Interpreter

An interpreter for the Amoeba programming language. Written from scratch in Go with no dependencies πŸŽ‰

Amoeba Screenshot

Features

  • C-like syntax
  • variables (integers, booleans, strings, arrays, objects)
  • arithmetic expressions
  • first-class and higher-order functions
  • closures
  • builtin functions:
    • amoeba(): prints out awesome ascii art
    • len(ARRAY or STRING): returns length of string or array
    • push(ARRAY, ANY): adds new item to array (does not mutate)
    • first(ARRAY): returns first item in array
    • rest(ARRAY): returns all but first item in array
    • last(ARRAY): returns last item in array
    • print(ANY, ANY, ...): prints out to the console

Give it a try!

Clone

  1. git clone https://github.com/ASteinheiser/amoeba-interpreter.git
  2. cd amoeba-interpreter

Then pass a file path as an argument

./amoeba-interpreter -file=amoeba-test-program.txt

OR use the REPL

./amoeba-interpreter

REPL Screenshot

Local Dev

  1. Install Go
  2. git clone https://github.com/ASteinheiser/amoeba-interpreter.git
  3. cd amoeba-interpreter
  4. go run main.go

Run the test suite

You can run the tests for a sub-module individually as long as it has a *_test.go file:

go test ./ast/
go test ./lexer/
go test ./parser/
go test ./evaluator/

OR you can run all the tests at once:

./run-tests.sh

Tests Screenshot

Roadmap

  • add <= and >= operators
  • add postfix operators (such as ++)
  • prettier printing of function, array, and hash values
  • enhance error messages with line number and file name

About

An interpreter for the Amoeba programming language. Written from scratch in Go with no dependencies πŸŽ‰

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

Contributors

AltStyle γ«γ‚ˆγ£γ¦ε€‰ζ›γ•γ‚ŒγŸγƒšγƒΌγ‚Έ (->γ‚ͺγƒͺγ‚ΈγƒŠγƒ«) /