25 Commits

Author SHA1 Message Date
251b1b82b1 Add registers and fix section primitive parser 2025-04-02 12:04:42 +02:00
8faf73771b Fix parser loops in parse_any and parse_consecutive 2025-04-02 12:04:42 +02:00
4d8cbc066b Add more grammar rules to the parser 2025-04-02 12:04:42 +02:00
5968997d19 Add a parser combinator to parse a delimited list 2025-04-02 12:04:42 +02:00
eb3b9d6366 TODO: REVIEW ME AND WRITE PROPER MESSAGE
Fix lexer issue where consuming n tokens always fails if there are n
tokens and always succeeds if they aren't n tokens
2025-04-02 12:04:42 +02:00
ff4b01acea Use new validator function for parse_token calls on all primitives
Also adds new validated primitives for NODE_SECTION and NODE_REGISTER
2025-04-02 12:04:42 +02:00
9eec8e5e1a Fix incorrect error returned in parse_consecutive 2025-04-02 12:04:42 +02:00
234f614886 Add basic parser combinators 2025-04-02 12:04:42 +02:00
8ac844c2b0 Add "primitive" parsers for all the semantic tokens in the lexer grammar 2025-04-02 12:04:42 +02:00
56d1054b74 Fix parse_token to add the correct information to a parse node 2025-04-02 12:04:42 +02:00
d7dc6c802e Partial parser implementation 2025-04-02 12:04:42 +02:00
e2fa229c1d Add basic parser utilities 2025-04-02 12:04:36 +02:00
5fb6ebef28 Add functions to skip over trivia in a tokenlist 2025-04-02 11:59:24 +02:00
bbdcad024f Add function to print the AST 2025-04-02 11:50:25 +02:00
935da30257 Add basic AST functionality 2025-04-02 11:35:53 +02:00
34ace36920 Add a parser grammar 2025-04-02 11:28:58 +02:00
bd37ddaeea Add tokenlist, a linked list of lexer tokens
The linked list is doubly linked so the parser can look forward into it
and error reporting can look backward.

This commmit also reworks main to use the tokenlist instead of dealing
with the lexer manually.
2025-03-31 18:43:34 +02:00
42da7b1d05 Move err_allocation_failed into error.c and make it available to
everyone.
2025-03-31 18:43:34 +02:00
75fc72c35d Add action to run validation on every commit
All checks were successful
Validate the build / validate-build (push) Successful in 23s
Adds some flags to the makefile to make it build on alpine with a
different libc
2025-03-31 14:36:15 +02:00
5cdb60d395 Remove peek function 2025-03-30 22:51:47 +02:00
e5830daac9 Add documentation comments to the lexer code 2025-03-30 22:51:15 +02:00
4becfb868e Reduce excessive line length in Makefile 2025-03-30 22:07:35 +02:00
942dd444cc Fix infinite loop when lexing an invalid newline sequence 2025-03-30 22:03:12 +02:00
55f6dff543 Add basic fuzzing with afl++ 2025-03-30 22:01:53 +02:00
df948b18c6 Initial commit, basic lexer structure 2025-03-30 17:45:51 +02:00