Skip to content

Latest commit

 

History

History
140 lines (116 loc) · 4.76 KB

README.md

File metadata and controls

140 lines (116 loc) · 4.76 KB

Burlap

A powerful and user-friendly sack interpreter, v1.1.5

What is Burlap?

Burlap is a interpreter for the Sack programming language. It aims for a high level of spec compliance, any valid sack program should be able to be run using burlap (it does have a few minor variations from the spec, known differences are listed here)

Features

  • Complete sack v0.0.5 support
  • Complete sack v1.0.0 support
    • Types
      • Strings
      • Number
      • Decimal
      • Bool
      • None
      • Lists (New)
      • Byte (New)
      • type function (New)
    • Operators
      • Logical operators (&&, ||, ^^, !)
      • Comparison operators (>, <, >=, <=, ==, !=)
      • Mathematical operators (+, -, *, /, %)
      • Variable operators (=, +=, -=, *=, /=)
    • Print
    • Input (New)
    • Len (New)
    • Args (New)
    • If/if else/else
    • Return
    • Functions
    • Loops
      • Range loops
      • While loops (New)
    • Casting
    • Import
    • Scope
    • File IO (New)
      • Open (New)
      • Read (New)
      • Write (New)
      • Close (New)
      • Flush (New)
      • Seek (New)
  • Lexing errors
  • Parsing errors
  • Runtime errors
  • REPL
    • Tab-completion
    • Colors
    • History
    • Multiline editing
  • Extra features
    • C interop for all number types
    • C interop for strings
    • Custom error messages
    • And more!

Building

It's a normal rust project, so cargo run to run, cargo build to build, and cargo build --release to build in release mode (slower to build, a lot faster to run).

If you want to install it, run cargo install --git https://github.com/Bigjango13/Burlap, now you can use burlap as a command!

Running

If you don't use any arguments burlap will enter REPL mode, to exit use Ctrl-D. If you want to run a file just pass the file name as the argument. For example: burlap tests/test.sk

You can pass arguments by putting things after the file, for example: burlap tests/greet.sk Bob.

To run code from argv using -, for example: burlap - "print('Hello world!');".

To pass arguments to code in argv or the REPL use --, for example: burlap -- --some-flag

To show help, run burlap -h or burlap --help.

Tests

Feature test

The feature test can be ran with burlap tests/test.sk, after every run a file called tmp-filename-for-tests will be made as a part of file io tests. Sack currently doesn't have the ability to deleate files, it will need to be removed manually

Speed test

The speed test is currently only one test, it can be ran with burlap tests/speedtest.sk or you can have a benchmark made with hyperfine (or other related tool) like so: hyperfine "burlap tests/speedtest.sk" "python3 tests/speedtest.py"

History

Burlap started because I wanted to learn how to create a programming language. I knew about Sack and thought it would be a perfect way to dive in (and it was!). Anyway, here's the change log:

  • 1.1.5: Trying to selfhost update
    • Add args()
    • Add in as a binop
    • Add %= operator
    • Add guaranteed tail recursion
    • Remove boolean and none math
    • Make short circuiting operators short circuit
    • Make str return none on failure
    • Fix major bug with jumping instructions
    • Fix returning from a loop
    • Fix empty import bug
  • 1.1.4: Byte and file update
    • Add string indexing
    • Add string iterating
    • Add seek(file, pos)
    • Add byte(x) function
    • Make write not truncate
    • Make len zero indexed
    • Allow string casts to fail
    • Fixed compiler bug with the PUSH3 instruction
  • 1.1.3: REPL Update
    • Make block errors less noisy
    • Add multiline editing, highlighting, and tab-completion to the REPL
  • 1.1.2: C update
    • Added C iterop
    • Add __burlap_throw
    • Fixed global variables for imports
  • 1.1.1: File IO
    • Read, write, open, and flush
  • 1.1.0: VM update
    • Rewrite tree walking interpreter into a stack based VM
  • 1.0.0: Rust Evangelism Strike Force update
    • Decide to RIIR
    • Lists, while loops, input, imports, and more!
  • 0.0.1: C++ version works for Sack v0.0.5
  • Beta: I tried to make a Sack to Python transpiler in Python using regexes

Extensions

Burlap has some extra features that aren't part of the sack language, there is a list in them docs.

Goals/roadmap

  • Autoformatter
  • Debugger
  • Transpiling to another programming language

Alternatives

  • Skcore an older sack interpreteter