Skip to content

Language Interpreter for monkey language written in golang

License

Notifications You must be signed in to change notification settings

kd993595/MonkeyInterpreter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MonkeyInterpreter

Language Interpreter for monkey language written in golang Follows the book "Writing an Interpreter in Golang" Book

Monkey is a small, interpreted or compiled toy programming language with high-level simplicity and easy to write C-like syntax. The language features:

  • Turing-completeness
  • expressions like + - * / -(prefix) !(prefix) == != > <
  • local and global variables
  • functions/closures as first-class objects
  • everything is an expression
  • arrays [1, 2, 3]
  • strings "Hello"
  • full unit test coverage
  • written in 100% pure Go without external dependencies

Example: Fibbonaci in Monkey

let fibonacci = fn(x) {
    if(x == 0) {
        0
    } else {
        if(x == 1) {
			1
		} else {
			fibonacci(x - 1) + fibonacci(x - 2)
		}
    }
}

puts(fibonacci(10))

About

Language Interpreter for monkey language written in golang

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages