(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:
- Simple enough to handcraft.
- Stack based (no garbage-collection no reference-counter).
- 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.
- Lack of:
throw-try-catch-finally
,while
(just usingfor(;;)
),switch-case
,anonymous function
etc. - Lack of:
+=
,++
,%
,&
etc. - Not functional: seperate
function
withvalue
, nocallback
s. - Data is Data, function is not data or
function object
:var a = {b: 1}
ok, butvar a = {b: function() {}}
not. - Array == Object (just
table
s, like Lua), but only indexing bynumber
orstring
. SemiColon is not optional!
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.
- more & more test (~30 tests NOW)
- stdlib
- complicated data structures (object? array?)
- just tables
- object literals
- repl
- interpreter:
- some ast node have to be
clone
d all the time, how to share them? - function call pass param by value, AKA too many
clone
s.
- some ast node have to be
- virtual machine