Skip to content

SpencerCDixon/oak-lang

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Oak

A simple Ruby/JavaScript like language implemented in Go.

Why?

This project is just a tool to help me learn about lexers, parsers, and interpreters/compilers. DISCLAIMER: I wouldn't use this language for anything serious.

What/How?

Oak comes with a basic CLI. To get going quickly:

Install:

$ go get github.com/spencercdixon/oak

Execute:

$ oak run ./path/to/source/code.oak

Explore:

$ oak repl

Language Features

  • Arrays
  • Integers
  • Strings (double quote)
  • Functions (defined with 'fn')
  • Closures
  • Hashes
  • Error reporting
  • ... more complete docs coming ...

CLI

A tree that bears acorns as fruit, and typically has lobed deciduous leaves.  Also, lets you write code.

Usage:
  oak [command]

Available Commands:
  help        Help about any command
  repl        Interactive console to play with oak code.
  run         Execute oak source code
  version     All software needs versions.  This is oaks.

Flags:
      --config string   config file (default is $HOME/.oak.yaml)

Use "oak [command] --help" for more information about a command.

Errors

When running some broken oak code like:

let queue = []

push(queu, 1)

Oak will give you nice error messages using Levenshtien Distance algorithm.

ERROR: identifier queu not found.

Did you mean one of:

 queue

Development

If you happen to be interested in adding functionality or just want to play with Oak locally here are some things that might help:

TODO

  • add Levenshtein Distance algorithm for better error msgs
  • add ability to write comments in source code
  • add nice HTTP primitives to make oak shine
  • write documentation for basic data structures
  • create some 'real-world' examples of using the language
  • add benchmarking to a real world http example to compare to Ruby
  • add basic module system so code can be separated
  • add support for hashes
  • add support for http request primitive
  • add << append string support

About

Toy language to help learn about interpreters

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published