Commit Graph

112 Commits

Author SHA1 Message Date
Karma Riuk
47379c6635 implemented simple evaluator for program,
statements and integer literals, together with
tests
2025-07-19 15:03:38 +02:00
Karma Riuk
7b01840f4d moved some stuff around in an attempt to make
things cleaner (not sure it is, but we tryin)
2025-07-19 13:41:25 +02:00
Karma Riuk
c943380d58 moved the utils for the parser to a global utils
folder for the tests (that utils is includable
only by the tests and not the src code, I added a
compiler flag only for the tests in the makefile,
but the compiler_flags.txt is global for the lsp,
gotta be careful with that)
2025-07-19 13:27:25 +02:00
Karma Riuk
d1dd5f9dab made our wrapper objects for all of our primitve
datatypes: ints, bools and null
2025-07-19 13:04:30 +02:00
Karma Riuk
c841cfe680 made the RLPL (read-lex-print-loop) become a
RPPL (read-parse-print-loop)
2025-07-15 20:21:53 +02:00
Karma Riuk
20b2c4a818 added checks for operator precedence with function
call
2025-07-15 20:09:08 +02:00
Karma Riuk
2b811a4bb9 added tests for malformed function call to check
for memory safety
2025-07-15 20:00:30 +02:00
Karma Riuk
a016bbaa5e added parsing of function call 2025-07-15 19:42:43 +02:00
Karma Riuk
59bff59cf7 renamed function for parsing function literal
to avoid confusion with parsing function calls
2025-07-15 09:25:00 +02:00
Karma Riuk
98fb161bba added macro for debugging 2025-07-15 01:43:39 +02:00
Karma Riuk
6313027d07 reformulated the parsing of the parameters and
made it memory safe
2025-07-15 01:43:22 +02:00
Karma Riuk
4a9deff8da extracted the parsing of the function parameters
into it's own function (will be useful for the
parsing of the parameters in the function calls)
2025-07-15 01:18:00 +02:00
Karma Riuk
e2dfca2679 renamed function->block to function->body 2025-07-15 01:13:52 +02:00
Karma Riuk
c6daa5c2af added tests for malformed function literal to
check for memory leaks
2025-07-15 01:11:53 +02:00
Karma Riuk
afbabd6c9e added check for corner case 2025-07-15 01:11:46 +02:00
Karma Riuk
057d6fc9f1 renamed subcase properly 2025-07-15 00:58:49 +02:00
Karma Riuk
0b2a12cef7 added parsing for function literals 2025-07-15 00:56:40 +02:00
Karma Riuk
85f530f5f9 made the parsing functions for the different nodes
return the type they are parsing (necessary for
the parsing of the identifiers while parsing the
list of parameteres in a function literal)
2025-07-15 00:24:53 +02:00
Karma Riuk
586a172d90 removed sus blank line 2025-07-15 00:07:39 +02:00
Karma Riuk
767a2ebcb1 added tests for malformed if to check of memory
leaks
2025-07-15 00:05:48 +02:00
Karma Riuk
d94bb99381 fixed implementation of parse block 2025-07-15 00:04:58 +02:00
Karma Riuk
7c55e58e1a removed captures that don't capture because of
scope issues with doctest
2025-07-14 23:56:51 +02:00
Karma Riuk
cbafb2e814 extracted and abstracted function 2025-07-14 20:15:51 +02:00
Karma Riuk
f0f748f7f5 uncommented tracers and using a macro to enable it
or disable it
2025-07-14 20:15:18 +02:00
Karma Riuk
1cda075f57 added guards for freeing pointers because it
caused seg faults
2025-07-14 20:14:54 +02:00
Karma Riuk
97b81e6771 fixed mistake that caused undefined behaviour 2025-07-14 20:14:39 +02:00
Karma Riuk
870567ec6b removed dereferencing pointers when outputing to
stdout because i wanted the option of seeing
wethere a pointer was null or not
2025-07-14 20:14:03 +02:00
Karma Riuk
34e4bfe9c9 fixed some memory leaks 2025-07-14 15:20:30 +02:00
Karma Riuk
9e63c923da added parsing of if statements 2025-07-14 15:19:05 +02:00
Karma Riuk
86574552aa added parsing and testing for grouped expressions 2025-07-12 15:22:45 +02:00
Karma Riuk
ab17545c93 made another test for boolean parsing in general
expression
2025-07-12 15:07:47 +02:00
Karma Riuk
e170afc840 used overloaded function to make code cleaner 2025-07-11 22:17:01 +02:00
Karma Riuk
aaec4cefcf added prefix parsing for boolean literals 2025-07-11 21:00:11 +02:00
Karma Riuk
4da5f32aea added boolean literals and tests for them (no
parsing yet)
2025-07-11 20:55:02 +02:00
Karma Riuk
8c1f4e10cd made more helper functions for testing 2025-07-11 20:34:18 +02:00
Karma Riuk
6cd99c22fe added a way to show the call stack of the functions 2025-07-11 19:48:55 +02:00
Karma Riuk
c9ffeafd5f added extensive testing for operator precedence 2025-07-11 11:39:55 +02:00
Karma Riuk
a1192204b1 fixed slight bug 2025-07-11 11:39:48 +02:00
Karma Riuk
7192bb318c fixed the to string function of some nodes 2025-07-11 11:39:45 +02:00
Karma Riuk
552e68169f fixed compiler warning 2025-07-11 11:21:45 +02:00
Karma Riuk
63f22a1b40 removed unused include 2025-07-11 11:19:28 +02:00
Karma Riuk
2174781b77 using smart pointers instead of normal ones for
easier setup of tests (to call setup() multiple
times without leaks)
2025-07-11 11:16:16 +02:00
Karma Riuk
826f4de77a updated return tests 2025-07-11 11:10:29 +02:00
Karma Riuk
a7f5950a55 implemented infix operator parsing 2025-07-11 10:30:37 +02:00
Karma Riuk
6e471a91d5 fixed test 2025-07-11 10:30:28 +02:00
Karma Riuk
1ec438c900 made infix string better 2025-07-11 09:12:42 +02:00
Karma Riuk
702c34a736 written tests for infix expressions 2025-07-11 09:07:33 +02:00
Karma Riuk
f038d30d77 written the test in a different way, since we
can't use for loops around subcases
2025-07-11 09:07:12 +02:00
Karma Riuk
ed3cf748e2 properly deallocating the prefix obeject 2025-07-11 09:01:09 +02:00
Karma Riuk
c55c6b2b20 forgot that statement and expression had a common
ancestor
2025-07-11 08:45:15 +02:00