6 releases

0.3.0 Jun 29, 2024
0.2.1 Jun 29, 2024
0.1.2 Jun 29, 2024

#94 in Programming languages

MIT license

33KB
884 lines

Iodine

  • Stack based programming language

Inspiration

Installation

  cargo install iodine

Usage

  cargo build --release
  ./target/release/iodine -i <input.iod>

Example

fdef square : number
    dup *
fend

1 1 +
420 0.5 *
420 dup -
420 69 > if "420 IS more than 69" print end
3 square 9 == if "3^2 is 9!" print end

Features

  • Basic math operations (See quirks)
  • If statements
  • Function return types
  • Functions
  • Comparisons between numbers
  • Signed / unsigned integers, floating point numbers
  • Strings (They don't serve any purpose for now)
  • Comments
  • Simple stack operations (drop, dup)

Quirks

  • Any math operation on any integer type result is a f64:
# Output: 4.0 #
2 2 +

TODO

  • Including files
  • Don't coerce all numbers to f64 after any math operation
  • More stack operations
  • Reading from files
  • Arrays
  • Escaped strings

Dependencies

~1.1–1.7MB
~32K SLoC