K Lange
2bd0d93596
Add kuroko.argv
2021-01-08 19:05:11 +09:00
K. Lange
3735b9c16b
Raise KeyboardInterrupt on ^C
2021-01-08 16:40:43 +09:00
K. Lange
0a9276863c
Move module_paths to 'kuroko' insted of __builtins__
2021-01-08 15:59:43 +09:00
K. Lange
5df14689bf
Tab completion for basic fields/methods in the repl
2021-01-07 18:47:36 +09:00
K. Lange
0c4c4c95f9
Add module class with nice repr
2021-01-07 12:13:47 +09:00
K. Lange
ecb5f1e4ec
Attach __doc__ to modules, default to None (but still set) if missing
2021-01-07 11:30:10 +09:00
K. Lange
4266bf60e7
Attach globals to callframes and get rid of vm.globals
2021-01-07 10:52:29 +09:00
K. Lange
902d2222b5
Make modules work like in Python. TODO: module class for better repring
2021-01-07 09:50:58 +09:00
K. Lange
d6525a1f32
Add tuple.__iter__, internalize list.__iter__
2021-01-07 08:27:40 +09:00
K. Lange
3c6b45709a
Add an optional watchdog timer (set vm.watchdog and build with -DENABLE_WATCHDOG)
2021-01-06 10:40:23 +09:00
K. Lange
1d02ed3c7d
Expose krk_dumpTraceback so, eg., bim can call it at the right time
2021-01-05 23:23:16 +09:00
K. Lange
2f78ae8770
maybe support __eq__?
2021-01-05 17:41:32 +09:00
K. Lange
c8758c9ffb
Add tuple type to store immutable lists
2021-01-05 11:38:11 +09:00
K. Lange
f1ebada908
Add string iterators
2021-01-04 19:34:56 +09:00
K. Lange
49b7eb2941
Super speedy getters and setters
2021-01-04 17:47:53 +09:00
K. Lange
fb9d0163ef
Some more objects
2021-01-04 17:29:06 +09:00
K. Lange
eb383e7663
Support __call__ on instances
2021-01-04 16:21:27 +09:00
K. Lange
b8c89c0550
add ValueError to builtin exceptions
2021-01-04 11:27:33 +09:00
K. Lange
8ad29f7891
Ditch character literals and add single, triple strings
2021-01-03 14:09:45 +09:00
K. Lange
0966a21c7a
Move sleep, uname to Pythonic module names
2021-01-03 09:49:19 +09:00
K. Lange
b676df69da
Add method decorators
...
This required a new approach for handling function arguments.
Methods remain the same: the callee object is on the stack and positioned
to be "argument 0". Non-methods have changed so that "argument 0" is the
first argument, with the function still remaining before that. When a
non-method is called, we track this fact so that we can continue to restore
the stack to the correct height to get rid of the function. This allows
a method decorator to be defined exactly like it would be in Python
def methodDecorator(func):
def wrappedMethod(instance, someOtherArg):
print "Do something with the arg:", someOtherArg
func(instance)
class Foo():
@methodDecorator
def func():
print "I only take an implicit self:", self
let f = Foo()
f.func("but that other arg is needed")
2021-01-03 08:43:32 +09:00
K. Lange
542e219192
Redefine list comprehension and add infix in
2021-01-02 19:46:21 +09:00
K. Lange
cbdd60d768
Do some simple recursion avoidence and improve reprs in lists/dicts
2021-01-02 14:28:37 +09:00
K. Lange
6164c3ebf4
General code cleanup.
2021-01-02 12:21:11 +09:00
K. Lange
6e4ff9f791
.. and fix uname()
2021-01-01 21:07:42 +09:00
K. Lange
b42844f842
Fully internalize list+dict core methods and implement invokes for getters/setters
2021-01-01 20:52:18 +09:00
K. Lange
ae2e2be15d
do something more straightforward and useful for methods on non-objects
2021-01-01 16:02:16 +09:00
K. Lange
8e5ace5112
Make classes for base types and exceptions
2021-01-01 12:04:58 +09:00
K. Lange
2b3a5cec60
String slicing, and general syntax support
2020-12-31 18:32:37 +09:00
K. Lange
aa3674dd32
implement shared object module support
2020-12-31 15:48:39 +09:00
K. Lange
c2e5eeceb7
Internal binding functions should look at the stack from the top, not the bottom; they may run with stuff on the stack...
2020-12-31 14:46:02 +09:00
K. Lange
764f9144f8
Add __base__, isinstance(), and track superclass in the VM and not just implicitly by super() calls.
2020-12-31 09:15:53 +09:00
K. Lange
0b2c9df58f
shove list comprehensions into their own fake call frames because everything is terrible
2020-12-30 22:30:09 +09:00
K. Lange
f7e1c0da0d
Add docstrings, __doc__, and help()
2020-12-30 16:59:21 +09:00
K. Lange
a5928b18c9
bite the bullet and rename length() to __len__()
2020-12-30 15:50:26 +09:00
K. Lange
430f20566e
allow native functions to be bound as methods with a little work
2020-12-29 20:31:35 +09:00
K. Lange
7dfd853217
More stuff for embedding
2020-12-29 18:51:03 +09:00
K. Lange
b0c2772937
switch some type conversions to bound methods
2020-12-29 16:40:42 +09:00
K. Lange
c6e5c8c120
once again, completely redo the parsing for indentation so that we can have pretty syntax errors
2020-12-29 15:26:45 +09:00
K. Lange
54c3779938
fix up handling of exceptions in module imports
2020-12-29 13:19:22 +09:00
K. Lange
a0d52a61f2
add an exception mechanism
2020-12-29 11:00:12 +09:00
K. Lange
067d8cdb65
fix upvalue storage being completely broken when we move the stack
2020-12-28 22:02:39 +09:00
K. Lange
3ba8025eeb
lots of fixups so we can create dicts from the vm
2020-12-28 20:38:26 +09:00
K. Lange
b3ad2e1f22
Second pass at cleaning up built-ins
2020-12-28 19:26:01 +09:00
K. Lange
cdcbf6cf54
First pass at module/builtin cleanup
2020-12-28 19:01:28 +09:00
K Lange
5a5c597033
little repl improvements
2020-12-28 11:25:42 +09:00
K Lange
ac15ca117c
Clean up some pedantic warning stuff
2020-12-28 11:11:50 +09:00
K. Lange
f62f6f84e2
fix up some bad garbage collections with modules
2020-12-28 13:51:14 +09:00
K. Lange
8f42695f36
Fix up repl
2020-12-28 10:54:25 +09:00
K. Lange
3bcc5d5530
Synthesized properties and methods for strings
2020-12-28 09:08:35 +09:00