Commit Graph

174 Commits

Author SHA1 Message Date
K. Lange
5c1d8f24b6 more AOC test cases 2021-01-04 20:27:32 +09:00
K. Lange
f4cbf2ec38 this is now a late AOC2020 repo 2021-01-04 20:10:39 +09:00
K. Lange
6195649458 More test scripts 2021-01-04 19:59:11 +09:00
K. Lange
873ffb3428 Eat empty line in block? 2021-01-04 19:56:13 +09:00
K. Lange
f1ebada908 Add string iterators 2021-01-04 19:34:56 +09:00
K. Lange
7b8df5d4da More test files 2021-01-04 19:07:46 +09:00
K. Lange
8f2e7f237e List slicing and a gc fix for iterators 2021-01-04 19:07:39 +09:00
K. Lange
bfae38538d Need to turn off whitespace eating _before_ the close paren 2021-01-04 19:07:19 +09:00
K. Lange
61a38f3a5f That dup isn't necessary 2021-01-04 18:15:17 +09:00
K. Lange
b93429d6a6 Oops, fix strings; simplify bytecode around getters/setters; use this approach for slicing 2021-01-04 18:10:55 +09:00
K. Lange
49b7eb2941 Super speedy getters and setters 2021-01-04 17:47:53 +09:00
K. Lange
49d2a26aa4 repl must reset stack after printing values since they run without a callframe 2021-01-04 17:47:44 +09:00
K. Lange
fb9d0163ef Some more objects 2021-01-04 17:29:06 +09:00
K. Lange
66533d5c23 C-ify a bunch of basic builtin functions 2021-01-04 16:21:59 +09:00
K. Lange
eb383e7663 Support __call__ on instances 2021-01-04 16:21:27 +09:00
K. Lange
a1f29ee399 Fixup dirObject which we broke with __inrepr 2021-01-04 16:20:50 +09:00
K. Lange
cfecb2e4f6 Accept BIG_STRING as __doc__ 2021-01-04 16:20:01 +09:00
K. Lange
9941889f54 str.__contains__ 2021-01-04 14:03:19 +09:00
K. Lange
583df9141c 'not in' comparison 2021-01-04 14:03:08 +09:00
K. Lange
2f5b7ef262 Add str.split() 2021-01-04 12:47:57 +09:00
K. Lange
d1c2d3f234 Add str.join() 2021-01-04 12:01:50 +09:00
K. Lange
b25f2e6c73 Implement str.format() 2021-01-04 11:29:33 +09:00
K. Lange
b8c89c0550 add ValueError to builtin exceptions 2021-01-04 11:27:33 +09:00
K. Lange
3fd9bfecde Demonstrate how Python's default args behavior can be emulated 2021-01-04 10:02:44 +09:00
K. Lange
90a4dd678d Ignore line feeds and indentation in some contexts 2021-01-04 09:49:56 +09:00
K. Lange
132542c6ab allow 'elif' for Python compatibility 2021-01-04 09:13:39 +09:00
K. Lange
3415fd4e73 from foo import bar as baz 2021-01-04 07:48:56 +09:00
K. Lange
8ef070bf94 Support 'from foo import bar, baz' 2021-01-04 07:47:05 +09:00
K. Lange
d1d6a7a3fe 'let' should support multiple comma-separated declarations 2021-01-04 07:40:29 +09:00
K. Lange
aa1c0c8e93 Support 'import foo as bar' 2021-01-04 07:39:00 +09:00
K. Lange
0a0c5885e4 Fix cached imports not pushing module to stack 2021-01-04 07:38:44 +09:00
K. Lange
ce7f74cd03 Clean up README, update some exceptions, add notes on *args and **kwargs 2021-01-03 22:36:41 +09:00
K. Lange
edbb4f06e5 Try to catch some bad attempts to expand garbage 2021-01-03 22:36:24 +09:00
K. Lange
a1b873ee9c Simplify iterators 2021-01-03 21:48:41 +09:00
K. Lange
a903fd0a3e We can probably support this well enough, but just throw an error for now. 2021-01-03 18:38:27 +09:00
K. Lange
7dfa32f471 Fix some exceptional edge cases 2021-01-03 18:26:55 +09:00
K. Lange
2ee154ecf7 Add argument expansions... 2021-01-03 18:13:17 +09:00
K. Lange
0a042e7a38 Kinda shoddily support keyword args in native functions by shoving them on the end and setting a flag you can opt in to seeing 2021-01-03 16:23:22 +09:00
K. Lange
36716e3508 Support * and ** in function signatures for collections of additional arguments and keyword args 2021-01-03 16:02:50 +09:00
K. Lange
3f848dba19 merge string constants like Python does 2021-01-03 14:20:55 +09:00
K. Lange
8ad29f7891 Ditch character literals and add single, triple strings 2021-01-03 14:09:45 +09:00
K. Lange
e542b191e0 Another README section 2021-01-03 12:40:00 +09:00
K. Lange
76e70b79d0 Add default argument values.
Unlike in Python, I'm taking the approach of evaluating these at function
call time rather than definition time. Assigning things like empty lists/dicts
to default arguments has always been a ridiculous thing in Python, and I don't
want to make that mistake. I'm pretty sure Python only continues to do that
because it was something they didn't want to break for backwards compatibility
reasons even in Python 3.
2021-01-03 12:32:04 +09:00
K. Lange
e46d753999 Basic support for keyword arguments when calling functions. 2021-01-03 12:09:41 +09:00
K. Lange
0966a21c7a Move sleep, uname to Pythonic module names 2021-01-03 09:49:19 +09:00
K. Lange
a4ba95d5ea basic types not being instances is entirely an implementation detail at this point 2021-01-03 09:37:43 +09:00
K. Lange
fa742d2ff9 redundant statement 2021-01-03 09:32:02 +09:00
K. Lange
93af369b8c Quietly pretend we didn't just do that different from Python for no reason 2021-01-03 09:29:09 +09:00
K. Lange
7d8dfa2ffe Add some descriptions of decorators and a note about differences from Python in the README 2021-01-03 09:20:11 +09:00
K. Lange
310cbe4e70 Don't explode when trying to print a null bound method 2021-01-03 09:19:38 +09:00