Commit Graph

33 Commits

Author SHA1 Message Date
CPunch 3ea653b26d added file:write() & an optional `mode` param to os.open() 2023-09-06 17:29:38 -05:00
CPunch b3587f48a2 added os.open(); new file object
eg.
```lua
local err, file = os.open("LICENSE.md")
if err then
    // do error handling stuff
end

// passing "a" to read() will read the whole file
print(file:read("a"))
```
2023-09-05 14:38:24 -05:00
CPunch 9f19fd4f31 fix this test script 2023-08-29 16:51:04 -05:00
CPunch 2d0e63f706 forgot to update this a while back 2023-05-28 21:16:30 -05:00
CPunch 8ac8085d20 syntax: 'var'->'let' 'function'->'func'
- 'var' has some weird scoping connotations with users of JS. better to change it to 'let', which will decide whether to make the variable a local or a global
- 'func' looks visually appealing lol
- some minor refactoring done in cparse.c
2023-02-09 15:58:25 -06:00
CPunch b902ac90de removed CObjStream 2023-02-09 12:42:09 -06:00
CPunch 6056f8eb5b added clang-format 2023-02-09 12:32:48 -06:00
CPunch d761970f17 Added minimal testsuite for IC
- main.c will now report errors for passed scripts
2021-03-19 22:23:04 -05:00
cpunch b545e8e5e3 Added another example script 'compare.comso'
- This stresses the table implementation as well as cosmoV_equals
2021-02-23 11:50:41 -06:00
CPunch 85503025dd Added strings.cosmo example 2021-01-17 14:11:05 -06:00
CPunch 8cd0112c48 fixed __getter and __setter tables 2021-01-12 18:27:29 -06:00
CPunch 32162ce50c Updated examples and README to use proper syntax 2021-01-12 17:49:16 -06:00
CPunch 8dc8cef7dc better increment test 2021-01-10 13:20:09 -06:00
CPunch aaa37c61d0 updated increment.cosmo example 2021-01-08 23:07:44 -06:00
CPunch 4e968529dc __tostring example added 2021-01-03 17:35:52 -06:00
CPunch 58485d9375 better iterator example 2020-12-31 13:57:02 -06:00
CPunch e993cdd9fa Added `.` get/set support for dictionaries.
cosmoO_getObject and cosmoO_setObject were renamed to cosmoV_getRawObject and cosmoV_setRawObject respectively
`__init` is now required to be defined for a proto object to be instantiated.
other minor refactoring work done in src/cvm.c
2020-12-30 17:51:59 -06:00
CPunch 090cc62cce Added variadic functions
TOKEN_DOT_DOT_DOT was added to the lexer
variadic.cosmo was added to the examples directory
2020-12-26 22:01:22 -06:00
CPunch 42eec149f6 added comments to break.cosmo 2020-12-24 00:47:21 -06:00
CPunch a408353c25 added "break" and "continue" statements
a LoopState was added to the CCompilerState struct which keeps track of breaks, start chunk index, and the start scope of the active loop.
Also, break.cosmo was added to the examples directory, 'continue' and 'break' work as expected.
2020-12-24 00:41:00 -06:00
CPunch 0beeee0fdf Added dictionary support to OP_ITER
ISTRING_RESERVED was added to iStrings
call & callCFunction now use memmove instead of memcpy
Additionally, added cosmoO_setUserP, cosmoO_getUserP, cosmoO_setUserI and cosmoO_getUserI to the C API.
2020-12-17 19:44:04 -06:00
CPunch eede892eb0 made OP_ITER and OP_NEXT use CObjMethods 2020-12-16 03:51:50 -06:00
CPunch e5eca7bed6 Added iterable objects
__iter and __next are now reserved IStrings, OP_NEXT and OP_ITER have also been added. A new token (TOKEN_IN) has been added to the lexer. The parser now supports the for each loop (for i, ... in <object> do ... end).
savedPushed has been removed from the CCompilerState struct.
2020-12-15 21:21:51 -06:00
CPunch 9aa7fa1381 replaced facttest.lua with fibtest.lua
Optimized the NaN box to be byte aligned, performance under the fibtest.lua script improved by ~2.5 seconds (~31 before ~28.5 after on cpunch's machine)
also cleaned up some misc. comments
2020-12-07 23:26:55 -06:00
CPunch 9ca67c8408 changed class -> proto 2020-12-05 17:58:56 -06:00
CPunch 6485f90c2d updated README 2020-11-20 15:32:12 -06:00
CPunch 6d45c0a676 fixed __index 2020-11-20 15:10:49 -06:00
CPunch 46b99ab390 minor refactoring, added inc and dec operators 2020-11-19 14:41:21 -06:00
CPunch 4c4b5eae8d refactored stress test 2020-11-17 15:13:51 -06:00
CPunch aaed92424f CObjMethod refactor 2020-11-17 15:07:56 -06:00
CPunch 329d34aa43 fixed clang warnings 2020-11-17 13:17:23 -06:00
CPunch 204bec3d0a added IStrings, added __index functionality 2020-11-16 19:58:16 -06:00
CPunch 4ff1e59042 moved examples to examples folder 2020-11-13 17:50:55 -06:00