mirror of
https://github.com/zekexiao/pocketlang.git
synced 2025-02-06 04:37:47 +08:00
70 lines
2.3 KiB
Plaintext
70 lines
2.3 KiB
Plaintext
|
|
// Language features.
|
|
- Closure (literal function are would become closure).
|
|
- Utf8 support.
|
|
- Method
|
|
Reference: CPython
|
|
See: https://github.com/python/cpython/blob/6db2db91b96aaa1270c200ec931a2250fe2799c7/Python/ceval.c#L4344-L4380
|
|
Note: consider dynamic attribute for instances like python and make the variables defined at the class level
|
|
are static.
|
|
- Make assert a keyword and disable it on release build.
|
|
|
|
// To implement.
|
|
|
|
- implement 'lang.getMaxCallDepth()' (default=1000 like python) and
|
|
setMaxCallDepth(val) to change stack size at runtime. (at: pushCallFrame())
|
|
|
|
- change or add => to_string() to value.as_string
|
|
and add as_repr, as_bool.
|
|
|
|
- Implement gdb like debugger (add color print for readability).
|
|
- Complete all the TODO; macros.
|
|
- implement MAX_ARGC checks (would cause a buffer overflow if not)
|
|
when compiling and calling a function (also in fibers).
|
|
|
|
// Low priority.
|
|
- Ignore line with '\' character.
|
|
- Make it possible to override function names.
|
|
- To do so the functions and global variables should be in the same
|
|
buffer as the property of the script.
|
|
- Union tagging alter in var.
|
|
|
|
// Add more.
|
|
- Single header for embedding (script in pk, require file IO).
|
|
- Complete core methods.
|
|
- Complete var methods.
|
|
- Complete core functions.
|
|
- Complete builtin operators.
|
|
- Complete opcodes.
|
|
- Complete core libs.
|
|
- Complete the docs.
|
|
- More Tests.
|
|
|
|
// Enhancements
|
|
|
|
- Write a custom hex() function to cast uint64_t to hex
|
|
string (currently our max is uint32_t) and for binary
|
|
(C doesn't have a sprintf("%b", num) for us.
|
|
|
|
- Ensure that the bitwise operation result `a << b` can be fit
|
|
into a double value before casting it to one. and we're allowing
|
|
the integer overflow when shifting.
|
|
|
|
// Bugs.
|
|
It's at pre-alpha and every thing is left to
|
|
implement, and nothing would be work as expected.
|
|
|
|
- f = func print() end; print(f) # semicolon should be there.
|
|
def f() print() end print(f) # semicolon should be there.
|
|
make it okay to use semicolon freely like new lines.
|
|
|
|
- REPL error message should be the first one (not the last).
|
|
>>> def f()
|
|
... _f = func()
|
|
... _f() // _f not defined (no closure).
|
|
... end
|
|
Error: Expected an expression // expected Name '_f' not defined.
|
|
|
|
Update: The above code just terminates in repl without printing any
|
|
error messages.
|