/vas

vas programming language

Primary LanguageRustMIT LicenseMIT

Vas Programming Language

(Ja)vas(cript) is some weird but sane subset(not really, just looks like) of early javascript (es3 i suppose).

It is DESIGNED to be:

  1. Simple enough to handcraft.
  2. Stack based (no garbage-collection no reference-counter).
  3. No deps (norm is sexy, anyhow is handy, smartstring can boost, but no thanks).

CAUTION: Just some i-have-to-write-a-language-once-in-my-life project.

Weird

  1. Lack of: throw-try-catch-finally, while (just using for(;;)), switch-case, anonymous function etc.
  2. Lack of: +=, ++, %, & etc.
  3. Not functional: seperate function with value, no callbacks.
  4. Data is Data, function is not data or function object: var a = {b: 1} ok, but var a = {b: function() {}} not.
  5. Array == Object (just tables, like Lua), but only indexing by number or string.
  6. SemiColon is not optional!

But Sane

var a; // a == null

undefined is gone.

true === false; // not ok

=== is gone.

function notCtor() {}
new notCtor(); // not ok

new and prototype are gone.

var a = 1;
var b = false;
var c = null;
var d = "string";

a + a; // num + num ok
d + d; // string + string ok
b || b; // bool || bool ok

// all else are not ok

dynamic but not THAT dynamic.

function evil() {
	a = 1;
}

evil();

would throw undefined variable instead of assigning to global.

TODOs

  • more & more test (~30 tests NOW)
  • stdlib
  • complicated data structures (object? array?)
    • just tables
  • object literals
  • repl
  • interpreter:
    • some ast node have to be cloned all the time, how to share them?
    • function call pass param by value, AKA too many clones.
  • virtual machine