12 Commits

Author SHA1 Message Date
2880ba81ab Implement break & continue
- Fix return propagation inside loops
2022-02-10 13:13:15 +01:00
aeedfb4ef2 Implement functions
- Implement function declaration and call
- Change the precalculated variable stack positions to contain the
  offset from the end instead of the absolute position. This is
  important for passing fun args on the stack
- Add the ability to offset the stackframes. This is used to delete the
  stack where the fun args have been stored before the block executes
- Implement exit type for blocks in interpreter. This is used to get the
  return values and propagate them where needed
- Add recursive fibonacci examples
2022-02-10 01:26:11 +01:00
383da4ae05 Rewrite declaration as statement instead of binop
- Declarations are now separate statements
- Generate unknown var errors when vars are not declared
- Replace Peekable by new custom PutBackIter type that allows for
  unlimited putback and therefore look-ahead
2022-02-09 16:54:06 +01:00
7ea5f67f9c Cleaner unop parsing 2022-02-09 14:23:24 +01:00
fdef796440 Update token macros 2022-02-08 23:26:23 +01:00
726dd62794 Big token refactoring
- Extract keywords, literals and combo tokens into separate sub-enums
- Add a macro for quickly generating all tokens including the sub-enum
  tokens. This also takes less chars to write
2022-02-08 18:56:17 +01:00
cf2e5348bb Implement arrays 2022-02-04 18:48:45 +01:00
d8f5b876ac Implement String Literals
- String literals can be stored in variables, but are fully immutable
  and are not compatible with any operators
2022-02-02 19:38:28 +01:00
39bd4400b4 Implement logical not 2022-02-02 19:14:11 +01:00
de0bbb8171 Implement logical and / or 2022-02-02 18:56:45 +01:00
dd9ca660cc Move ast into separate file 2022-02-02 16:43:14 +01:00
7e2ef49481 Move token into separate file 2022-02-02 16:40:05 +01:00