Commit Graph

63 Commits

Author SHA1 Message Date
Mattia Giambirtone 94ce81b6f1 Updated .gitignore, slightly edited README and added some more tests 2022-06-19 14:45:38 +02:00
Mattia Giambirtone 998ba94902 More fixes for assigning builtin functions to variables 2022-06-14 23:34:42 +02:00
Mattia Giambirtone 62e7cfeb89 Initial work on generics and fixed bugs in the parser with stropped operator names 2022-06-14 22:45:32 +02:00
Mattia Giambirtone 8a46c616d1 Added built-in operators as a single instruction (src/peon/stdlib/arithmetics.pn is now fully functional) 2022-06-14 18:10:13 +02:00
Mattia Giambirtone 3abc243c06 Initial work on pragma handling (+ some parser fixes). Changed the way the lexer handles indentation and made tabs illegal. Added instructions for some operations on primitive types, removed file argument from serializer 2022-06-14 12:12:56 +02:00
Mattia Giambirtone 1531811adf Initial work on closures (again?) 2022-06-13 17:28:05 +02:00
Mattia Giambirtone 7214ea129f Fixed issues with returning/calling function objects 2022-06-13 15:44:53 +02:00
Mattia Giambirtone acf4735790 Various style fixes with nil checks, added PushC opcode, added support for calling function objects 2022-06-13 15:04:53 +02:00
Mattia Giambirtone fd9d931b26 More work on pragmas, returning functions now works 2022-06-08 16:07:08 +02:00
Mattia Giambirtone 3377cf12b0 Initial experimental support for parsing pragmas 2022-06-07 11:23:08 +02:00
Mattia Giambirtone 5051901339 Fixed logic bug within if/else construct 2022-06-02 12:19:18 +02:00
Mattia Giambirtone 887fa85ec0 Fixed if/else 2022-06-02 12:05:22 +02:00
Mattia Giambirtone cdb2c33897 Fixed local variables 2022-06-02 11:45:27 +02:00
Mattia Giambirtone 605a3b1d06 Fixed nested calls 2022-06-02 10:19:34 +02:00
Mattia Giambirtone 15166d26ca Fixed inverse parameter ordering (whoops) 2022-06-02 01:50:06 +02:00
Mattia Giambirtone cf133ff921 Initial work on a two-stack design 2022-06-02 01:33:56 +02:00
Mattia Giambirtone 320619d582 Fixed peon calling convention and various errors with function calls 2022-05-30 22:06:15 +02:00
Mattia Giambirtone 2829f3801d Removed debugging print (oops) 2022-05-30 12:33:30 +02:00
Mattia Giambirtone 12d303003e Various fixes to stack frame alignment and added incremental compilation to REPL 2022-05-30 12:32:24 +02:00
Mattia Giambirtone bea354cd59 Initial work on function calls 2022-05-30 09:29:03 +02:00
Mattia Giambirtone f4365dd95d Fixed some segfaults 2022-05-29 23:01:36 +02:00
Mattia Giambirtone a3834a27c3 Various fixes and stack frame changes 2022-05-29 17:04:19 +02:00
Mattia Giambirtone c3c2dc31f8 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 f430fe6232 Some work for heap vars, wip fixes for higher-order functions 2022-05-27 14:01:57 +02:00
Mattia Giambirtone 2fc599dac4 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 2167838355 Fixed issues with stack frames when returning from functions 2022-05-25 14:38:40 +02:00
Mattia Giambirtone 8ecbf23710 Fixed recursion error inside inferType 2022-05-25 14:17:58 +02:00
Mattia Giambirtone 0b834fdaf4 Fixed variable declarations not compiling in some cases 2022-05-25 12:15:45 +02:00
Mattia Giambirtone b137e06ac6 Initial work on CFI-like functionality for better debugging 2022-05-24 22:26:45 +02:00
Mattia Giambirtone f348b8e82e Various fixes to matchImpl. Variables can now shadow functions, but not other variables 2022-05-24 10:23:34 +02:00
Mattia Giambirtone 3e26ca4a1c Updated config.nim and changed mechanism for finding operators (also added binary operator lookup) 2022-05-24 09:56:11 +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 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 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 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 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 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 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 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