Commit Graph

271 Commits

Author SHA1 Message Date
Mattia Giambirtone 9dacda4009 Various fixes and stack frame changes 2022-05-29 17:04:19 +02:00
Mattia Giambirtone b0515d3573 Refactored the type system which no longer relies on AST node objects. Added types for ref, ptr and mutable types 2022-05-29 15:54:01 +02:00
Mattia Giambirtone bf9b9389ce Some work for heap vars, wip fixes for higher-order functions 2022-05-27 14:01:57 +02:00
Mattia Giambirtone 71c05ec1bf Fixed closure variables and debugger output with nested CFI data (also removed unneeded peon files) 2022-05-26 18:32:02 +02:00
Mattia Giambirtone 0f0a442578 Fixed issues with stack frames when returning from functions 2022-05-25 14:38:40 +02:00
Mattia Giambirtone e15b6a4915 Fixed recursion error inside inferType 2022-05-25 14:17:58 +02:00
Mattia Giambirtone 5bf5c6d3fd Fixed variable declarations not compiling in some cases 2022-05-25 12:15:45 +02:00
Mattia Giambirtone 990b54fa3e Made main.nim a bit nicer with command-line options 2022-05-25 11:49:21 +02:00
Mattia Giambirtone be4c2500ac Added info about CFI section and made minor changes to README 2022-05-25 11:36:12 +02:00
Mattia Giambirtone 48d1c3fc8c Initial work on CFI-like functionality for better debugging 2022-05-24 22:26:45 +02:00
Mattia Giambirtone dbeae16dc4 Various fixes to matchImpl. Variables can now shadow functions, but not other variables 2022-05-24 10:23:34 +02:00
Mattia Giambirtone 15f412bcac Updated config.nim and changed mechanism for finding operators (also added binary operator lookup) 2022-05-24 09:56:11 +02:00
Mattia Giambirtone 396f40d3d6 Added some docs, LoadVar to the VM and readInt32 2022-05-23 14:03:17 +02:00
Mattia Giambirtone 9c14bfae91 Initial work on generics, fixed StoreVar. declareName no longer emits any bytecode (as it doesn't need to) 2022-05-23 11:53:34 +02:00
Mattia Giambirtone 8d1699ff9e Refactored calling convention and added stack frame support to the VM as well as StoreVar 2022-05-23 10:49:38 +02:00
Mattia Giambirtone 5f43ea9490 Initial work on calls (with runtime support too) 2022-05-22 17:23:52 +02:00
Mattia Giambirtone 50b0f98f6a Removed raise in main.nim 2022-05-22 15:31:13 +02:00
Mattia Giambirtone 21a9689f6c Functions can now return functions which return functions... recursively. Initial work on forward declarations and function call resolution 2022-05-22 15:27:28 +02:00
Mattia Giambirtone 9f1769ab71 Added LoadVar support to the VM and fixed a minor mistake in the debugger output 2022-05-22 13:09:46 +02:00
Mattia Giambirtone 42ab1d4c6e Initial work on call resolution, added support for running files 2022-05-22 13:02:57 +02:00
Mattia Giambirtone 6d6ae3ee7a Fixed and improved error reporting and made the parser ignore whitespace/tab (again) 2022-05-22 11:49:38 +02:00
Mattia Giambirtone 7cf69cf0cf Added hasExplicitReturn field to function and lambda declarations to fix some errors with compiling them. Fixed minor issues with function and lambda parsing, the parser is now able to skip whitespace/tab tokens trasparently, made parser.done() inline, removed invalid state error from funDecl 2022-05-21 12:20:12 +02:00
Mattia Giambirtone e4c2ba2ce2 Got rid of serializedRaw in main module and prettyfied the output 2022-05-20 18:34:14 +02:00
Mattia Giambirtone 751cf644dc Removed unneded flags 2022-05-20 16:01:34 +02:00
Mattia Giambirtone beb853837a Added skeleton for future expansion 2022-05-20 15:55:28 +02:00
Mattia Giambirtone 1a0587d08b Minor style changes, removed findImpl from compiler, made the VM use the multibyte utilities, bytecode chunks now no longer store AST node objects and use a stream of bytes instead, fixed issues with endScope() in the compiler which would not pop properly from self.names, fixed issues with blockStmt in parser, added more multibyte utilities 2022-05-20 15:47:04 +02:00
Mattia Giambirtone 77bd0c8b6f Minor changes to bytecode file 2022-05-18 13:47:07 +02:00
Mattia Giambirtone cb21af4aa3 Added Makefile, prettyfied code, initial work on pragmas 2022-05-18 13:32:32 +02:00
Mattia Giambirtone e8cbec94bd Minor bug fixes 2022-05-16 19:40:13 +02:00
Mattia Giambirtone ffee77b6fc Made function jumps absolute 2022-05-16 19:31:17 +02:00
Mattia Giambirtone 620c56237a Fixed an issue with jump offsets and with functions return types 2022-05-16 19:23:38 +02:00
Mattia Giambirtone e823a459c8 Implemented jump opcodes and LoadUInt64 in the VM, some style and proc changes in the compiler, chunk constants are now type-aware, fixed various inheritance mistakes in the AST node, refined type inference system, moved types back to the compiler and completely redesigned operator parsing to be more modular 2022-05-07 10:48:42 +02:00
Mattia Giambirtone 6ec5619d04 Added missing typing module 2022-05-04 14:28:36 +02:00
Mattia Giambirtone c7500f610e Renamed all infer* functions to inferType, minor changes to signatures of declaration() and statement() 2022-05-04 14:27:15 +02:00
Mattia Giambirtone a1c5430773 Collections are no longer a compiler intrinsic. Added parser support for ptr/ref arguments 2022-05-04 14:01:38 +02:00
Mattia Giambirtone f189b0214e Initial work on simplifying the type system and added more VM utility functions 2022-05-02 23:19:31 +02:00
Mattia Giambirtone b4fffe18aa Completely reworked the type inference system. Initial work on specializing the constants table in the bytecode chunk 2022-05-02 17:26:38 +02:00
Mattia Giambirtone 0493181262 Removed broken optimizer module 2022-05-02 12:38:43 +02:00
Mattia Giambirtone 8d31b79302 The parser can now correctly recognize returning functions from other functions 2022-05-02 11:13:04 +02:00
Mattia Giambirtone f2b60bd9c4 Experimental support for multiple arguments of the same type using only one type declaration + various compiler fixes 2022-05-01 13:08:02 +02:00
Mattia Giambirtone 776968bffc Name stropping, added NoOp, minor AST fixes, removed builtin opcodes for most operations 2022-04-29 23:04:53 +02:00
Mattia Giambirtone 299b359344 Name stropping now is generic to identifiers 2022-04-29 17:15:57 +02:00
Mattia Giambirtone d81ceb6760 Added types module 2022-04-29 16:57:14 +02:00
Mattia Giambirtone 223ba603a7 Removed old JAPL type system. Initial dummy VM for testing purposes 2022-04-28 18:06:53 +02:00
Mattia Giambirtone 0e4eb82554 Fixed AST inheritance issues and got back to a working state 2022-04-28 11:50:10 +02:00
Mattia Giambirtone f26541d4ae BROKEN: Initial work on closed-over variables and attempt to cleanup the AST type structure 2022-04-27 16:03:48 +02:00
Mattia Giambirtone d7cb6eaae0 Bytecode is now serialized to a file 2022-04-26 16:22:23 +02:00
Mattia Giambirtone c1152b8859 Updated commit hash in config.nim 2022-04-26 13:05:17 +02:00
Mattia Giambirtone 76d2b4e59d Fixed various bugs with parsing and compiling functions as well as with jumping 2022-04-26 13:04:40 +02:00
Mattia Giambirtone 4839c9a341 Turned off optimizer (breaks compiler) further work on closures and scope resolution 2022-04-26 09:29:59 +02:00
Mattia Giambirtone d38ad5aab4 Initial work on static name resolution 2022-04-21 15:58:42 +02:00
Mattia Giambirtone 79ca72d983 Initial work on type inference and variable declarations. Minor changes to the optimizer 2022-04-21 15:25:29 +02:00
Mattia Giambirtone e02f159514 Initial work on inferring types 2022-04-12 12:18:25 +02:00
Mattia Giambirtone 025f8b463b Fixed parsing of argument-less function. Removed main.nim 2022-04-12 10:56:05 +02:00
Mattia Giambirtone 2c2cd03d4a Minor changes 2022-04-11 15:00:15 +02:00
Mattia Giambirtone 42c47fc0e8 Minor changes 2022-04-11 14:59:34 +02:00
Mattia Giambirtone 722d345979 Minor changes 2022-04-11 14:41:20 +02:00
Mattia Giambirtone 8a509f2de6 Minor changes to optimizer 2022-04-07 15:29:19 +02:00
Mattia Giambirtone a388333278 Hooked up old JAPL components 2022-04-07 15:06:15 +02:00
Mattia Giambirtone 78e169bd82 Hooked up the compiler and debugger (VERY experimental) 2022-04-07 13:02:23 +02:00
Mattia Giambirtone 15c46a2f46 Parser support for forward declarations 2022-04-07 12:15:34 +02:00
Mattia Giambirtone e1543f8ba6 Removed unused unnest() procedure 2022-04-07 11:52:05 +02:00
Mattia Giambirtone ae8d348e0d Added notes to README, minor changes to lexer and test file 2022-04-07 11:51:36 +02:00
Mattia Giambirtone e82ef02772 Minor changes to test.nim 2022-04-06 20:29:51 +02:00
Mattia Giambirtone 2756030b6d Experimental support for arbitrary user-defined operators 2022-04-06 20:08:36 +02:00
Mattia Giambirtone d1dbf771ab Minor changes to how await/yield expressions are parsed 2022-04-06 15:57:47 +02:00
Mattia Giambirtone 6789a45e28 Fixed a bug with parsing non base-10 numbers in the lexer. Minor fixes to the parser and updated docs and comments 2022-04-06 12:09:19 +02:00
Mattia Giambirtone dbab30952b Initial work on adding type support to the parser for declarations + fixes for lambdas 2022-04-05 15:52:58 +02:00
Mattia Giambirtone 7f950893c5 Wired up the parser 2022-04-05 11:23:59 +02:00
Mattia Giambirtone 21fda63fad Huge lexer refactoring 2022-04-05 00:26:01 +02:00
Mattia Giambirtone 76812a2091 Initial commit from JAPL with some changes 2022-04-04 12:29:23 +02:00