Commit Graph

19 Commits

Author SHA1 Message Date
CPunch 1fcb35168f fix makefile 2023-09-05 14:42:29 -05:00
CPunch 096d80d8df better repl input, using linenoise 2023-08-31 23:17:13 -05:00
CPunch 0633e87aa6 WIP: removed stale error handling
currently, scripts seem to run fine. however I'm a bit worried about stack related issues. maybe i'll need to reset state->top as well? but not entirely sure
2023-08-29 14:07:45 -05:00
CPunch f76f2ffa92 refactoring and cleanup
cosmoB_loadOSLib -> cosmoB_loadOS
2023-08-24 23:36:32 -05:00
CPunch 9537a2c7b8 major main.c refactoring
- now takes command line arguments:
Usage: ./bin/cosmo [-clsr] [args]

available options are:
-c <in> <out>   compile <in> and dump to <out>
-l <in>         load dump from <in>
-s <in...>              compile and run <in...> script(s)
-r                      start the repl
2023-05-28 20:52:12 -05:00
CPunch bc6eb9b6dc added cdump.[ch] and cundump.[ch] to makefile 2023-05-27 23:17:17 -05:00
CPunch 88284a0b6e Removed '-Werror' to the Makefile 2021-06-11 15:01:53 -05:00
cpunch 35466f691f Added C99 support, refactored headers 2021-02-15 16:20:04 -06:00
cpunch 1a96e411f2 Minor Makefile fix 2021-02-11 20:35:42 -06:00
cpunch fdd0d19308 Added CMake support
should make integration into visual studio easier for people
2021-02-11 20:34:04 -06:00
CPunch 84f7895684 Added modulo operator '%'
- added OP_MOD, which performs a modulo operation on the 2 <number> values on the stack. Pops the 2 values and pushes the result.
- also added TOKEN_PERCENT to the lexer, and extended binary() in cparse.c to support it.
2021-01-01 00:47:15 -06:00
CPunch e7212b939d Makefile now specifies C11 2020-12-26 22:03:14 -06:00
CPunch 181ef8a18c Added dictionaries {}
Objects are now separate from {} dictionaries

the . operator now only indexes fields on objects, the [] operator can only be used on objects if the __index or __newindex functions are defined

Additionally 4 new instructions have been added to the VM: OP_NEWDICT, OP_INDEX, OP_INCINDEX, and OP_NEWINDEX.

The syntax to create a dictionary is as follows { <key> : <value>, <otherkey> : <othervalue> } eg. { "hello" : "world", "foo" : 1337 }

The Lexer & Parser was extended to add the TOKEN_COLON ':' token.
2020-12-09 20:32:42 -06:00
CPunch 329d34aa43 fixed clang warnings 2020-11-17 13:17:23 -06:00
CPunch ffe4fc6930 disabled debug features by default 2020-11-12 17:02:12 -06:00
CPunch 01b796460a refactored internal strings 2020-11-12 16:52:56 -06:00
CPunch aa975b7330 minor refactoring + non-zero int fixed 2020-11-05 19:53:55 -06:00
CPunch e1d33855c3 added basic objects 2020-11-03 22:10:51 -06:00
CPunch 2e1b745624 Initial commit 2020-10-28 00:16:30 -05:00