All Projects → zac-garby → Radon

zac-garby / Radon

Licence: mit
A scripting language.

Programming Languages

go
31211 projects - #10 most used programming language
golang
3204 projects
language
365 projects

Projects that are alternatives of or similar to Radon

Tinyrb
A tiny subset of Ruby with a Lua'esc VM
Stars: ✭ 452 (+1954.55%)
Mutual labels:  compiler, parser, vm
Craftinginterpreters
Repository for the book "Crafting Interpreters"
Stars: ✭ 4,298 (+19436.36%)
Mutual labels:  compiler, parser
Kgt
BNF wrangling and railroad diagrams
Stars: ✭ 312 (+1318.18%)
Mutual labels:  compiler, parser
Mini C
Dr Strangehack, or: how to write a self-hosting C compiler in 10 hours
Stars: ✭ 372 (+1590.91%)
Mutual labels:  compiler, parser
Pyverilog
Python-based Hardware Design Processing Toolkit for Verilog HDL
Stars: ✭ 267 (+1113.64%)
Mutual labels:  compiler, parser
Exprtk
C++ Mathematical Expression Parsing And Evaluation Library
Stars: ✭ 301 (+1268.18%)
Mutual labels:  compiler, parser
Ratel Core
High performance JavaScript to JavaScript compiler with a Rust core
Stars: ✭ 367 (+1568.18%)
Mutual labels:  compiler, parser
Customasm
💻 An assembler for custom, user-defined instruction sets! https://hlorenzi.github.io/customasm/web/
Stars: ✭ 211 (+859.09%)
Mutual labels:  compiler, vm
Minigo
minigo🐥is a small Go compiler made from scratch. It can compile itself.
Stars: ✭ 456 (+1972.73%)
Mutual labels:  compiler, parser
Compiler
The Hoa\Compiler library.
Stars: ✭ 458 (+1981.82%)
Mutual labels:  compiler, parser
Smlvm
Smallrepo Virtual Machine
Stars: ✭ 265 (+1104.55%)
Mutual labels:  compiler, vm
Webassemblyjs
Toolchain for WebAssembly
Stars: ✭ 566 (+2472.73%)
Mutual labels:  compiler, parser
Mtail
extract internal monitoring data from application logs for collection in a timeseries database
Stars: ✭ 3,028 (+13663.64%)
Mutual labels:  compiler, vm
Ark
ArkScript is a small, fast, functional and scripting language for C++ projects
Stars: ✭ 312 (+1318.18%)
Mutual labels:  compiler, vm
Saltwater
A C compiler written in Rust, with a focus on good error messages.
Stars: ✭ 219 (+895.45%)
Mutual labels:  compiler, parser
Passerine
A small extensible programming language designed for concise expression with little code.
Stars: ✭ 341 (+1450%)
Mutual labels:  compiler, vm
Cub
The Cub Programming Language
Stars: ✭ 198 (+800%)
Mutual labels:  compiler, parser
Xdpw
XD Pascal: A small embeddable self-hosting Pascal compiler for Windows. Supports Go-style methods and interfaces
Stars: ✭ 199 (+804.55%)
Mutual labels:  compiler, parser
Tiny Compiler
A tiny compiler for a language featuring LL(2) with Lexer, Parser, ASM-like codegen and VM. Complex enough to give you a flavour of how the "real" thing works whilst not being a mere toy example
Stars: ✭ 425 (+1831.82%)
Mutual labels:  compiler, parser
Luago Book
《自己动手实现Lua》随书源代码
Stars: ✭ 514 (+2236.36%)
Mutual labels:  compiler, vm

Radon

Go Report Card

Radon is a minimalistic, dynamic, compiled scripting language which runs on a virtual machine. In this sense it's in the same category as languages such as Python or Ruby. It's in very early development, and obviously isn't ready for production code yet, but it's quite fun to mess around with and see how much it can already do.

If you come across something which should work or should be considered as part of the language, make an issue. At this stage, I'll probably accept most things. If you think you can fix it yourself, still make an issue so I don't accidentally do the same thing, but I'm very happy to accept pull requests :). A number of things have been added to the TODO/ideas list at the bottom of this file, so if you're bored and want something to work on that'd be great!

This is a total rewrite, with more focus on code quality, testing, and some slight improvements to the actual language. The old version has its own branch. This is still a work in progress, so I can't at all guarantee that it works. In fact, I can probably guarantee more that it won't.

For syntax highlighting and snippets in TextMate, install Radon.tmbundle from this repository.

calc input = do
  result = 0

  for char in input do
    result = match char where
      | "+" -> result + 1,
      | "-" -> result - 1,
      | "*" -> result * 2,
      | "/" -> result / 2
  end
end

What's implemented so far?

  • The AST
    • Tested
  • The lexer
    • Tested
  • The parser
    • Tested
  • All objects
    • Tested
  • Bytecode
    • Defined all instructions
    • Parsing instructions
    • Tested
  • Virtual Machine
    • All instructions
    • Scopes, stacks, etc...
    • Uh, everything else
    • Untested! :O

Building

To use Radon, you'll have to build it yourself for now, since there's no point in my putting a new version on GitHub every time it changes. First, download the project and cd to it:

go get github.com/zac-garby/radon
cd $GOPATH/src/github.com/zac-garby/radon

Then, install the dependencies and install the radon command:

dep ensure
go install

If $GOPATH/bin is in your $PATH variable, you can start the REPL using the radon command. Otherwise, you'll have to use the actual path to the binary: $GOPATH/bin/radon, although I do recommend adding $GOPATH/bin to $PATH. You also might want to mv $GOPATH/bin/radon /usr/local/bin.

TODO, or Some ideas

  • Some Haskell-style operators:
    • |> operator, e.g. 5 |> print
    • $ operator, e.g. print $ 5 + 3
  • Might be able to optimise tuple compilation by flattening the tree and calling MakeTuple
    • Probably only a very small performance increase though, but potentially worthwhile for large tuples
  • Make tuples actually be stored using contiguous memory
  • Currying, so calling a function with too few arguments would make a new curried function
  • Empty stack after each statement. Store bytecode indices of the start of each statement.
  • Parse lists as a circumfix operator [ ... ] with a tuple inside
  • Parse maps as a circumfix operator { ... } with a tuple of tuples inside, making the : operator the same as ,, but possibly a different precedence
  • Max call-stack size
  • Garbage collection
  • Might be a good idea to store strings as rune slices
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].