monkey-lang

command module
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 15, 2020 License: MIT Imports: 12 Imported by: 0

README

Build Status Go Report Card codecov GoDoc Go 1.12.9

Monkey Lang

Currently extending the Monkey programming language designed in Writing An Interpreter In Go and Writing a Compiler in Go.

I will formally document the language and it's features at some point, but for now I'm keeping a list of the additional functionality I've added on top of original design.

All additional features have been implemented for both the interpreter and the compiler:

  1. Ability to execute Monkey files (.mo file ext) in addition to the interactive console. This is now the default behavior. Add --console flag when executing to drop into the REPL instead.
  2. Both file execution and console usage respond to an --engine= flag where you can choose to use the evaluator or the VM.
  3. Logical operators && and ||
  4. Single line comments starting with //
  5. Multi line comments using /* */
  6. const variable declaration (although it only mocks let at this point until I add variable reassignment)
  7. Modulo operator %
  8. Postfix operators ++ and --
  9. Comparison operators >= and <=
  10. String comparisons using != and ==
  11. Line numbers throughout the tokens/lexer/parsing/evaluator used for better errors.
  12. Ability to have question marks in identifiers. Ex: has_attribute?
  13. Additional builtin functions: pop
  14. VS Code syntax highlighting extension. Not yet published, but working and provides basic syntax highlighting.
  15. Add installation support through brew
  16. Add travis CI for builds/tests & add roughly +20% code coverage

Installation

Option A:

brew tap bradford-hamilton/monkey
brew install bradford-hamilton/monkey/monkey

Option B:

If you mosey on over to releases, you'll find binaries for darwin, linux, windows, and amd64. You can download directly from there.

Option C:

If you have Go installed on your machine, use go install:

go install github.com/bradford-hamilton/monkey-lang

This will place the binary in your go/bin and is ready to use.

Usage

Build

go build -o monkey main.go

Run

./monkey [option...] filePath

Examples

Running with vm

./monkey --engine=vm examples/program.mo

Running with evaluator

./monkey --engine=eval examples/program.mo

Run interactive console

./monkey --console

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL