Skip to content

Repository files navigation

tanaid

tuh-NAY-id

i am learning rust and tcl by writing a tcl interpreter. i chose tcl because it is "very simple" and actually used for some things.

implements a (probably broken) subset of tcl:

this is enough to write simple scripts like:

proc fib {x} {
  if {$x <= 0} {
    return 0
  }
  if {$x == 1} {
    return 1
  }
  return [expr {[fib [expr {$x - 1}]] + [fib [expr {$x - 2}]]}]
}

set i 1
while {$i < 30} {
  puts [fib $i]
  set i [expr {$i + 1}]
}

Usage

cargo build --release

# repl
./target/release/tanaid

# run a script
./target/release/tanaid path/to/file.tcl

Setup

Install Rust with rustup:

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

Run any Cargo command from the repo root to install/use the toolchain:

cargo build

Development

Run the compiler checks with:

cargo check --all-targets

About

experimental Tcl interpreter with Rust lib, Typescript wasm bindings, web playground

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages