Commit Graph

34 Commits

Author SHA1 Message Date
omicron 0ec3d0fa35 Fix parser loops in parse_any and parse_consecutive 2025-04-02 11:29:09 +02:00
omicron 69571b344b Modify main to use the new print ast functionality 2025-04-02 11:29:09 +02:00
omicron ae2556ac9e TODO: REVIEW THIS FUNCTION Add function to print AST 2025-04-02 11:29:09 +02:00
omicron 4dc3ef8967 Add more grammar rules to the parser 2025-04-02 11:29:09 +02:00
omicron 449cffe79f Add a parser combinator to parse a delimited list 2025-04-02 11:29:09 +02:00
omicron 6794799b5f make parse_success always skip past trivia in the tokenlist 2025-04-02 11:29:09 +02:00
omicron a22cfb436e 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 11:29:09 +02:00
omicron f3894211e0 Match ast nodes to new grammar 2025-04-02 11:29:09 +02:00
omicron 836a0550d9 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 11:29:09 +02:00
omicron 249f0190d8 Fix incorrect error returned in parse_consecutive 2025-04-02 11:29:09 +02:00
omicron a09d591e86 Fix memory leak in ast.
If a node has children the array of children was never freed.
2025-04-02 11:29:09 +02:00
omicron f4638d43b6 Extend parse_token to accept an optional validator function 2025-04-02 11:29:09 +02:00
omicron fcbf96af48 Expose err_parse_no_match in parser_util.h 2025-04-02 11:29:09 +02:00
omicron 94ac826cde Add basic parser combinators 2025-04-02 11:29:09 +02:00
omicron 5d28c51cf1 Add "primitive" parsers for all the semantic tokens in the lexer grammar 2025-04-02 11:29:09 +02:00
omicron 89c7bb5253 Add basic parser utilities 2025-04-02 11:29:09 +02:00
omicron 69e1cb840c Add functions to skip over trivia in a tokenlist 2025-04-02 11:29:09 +02:00
omicron ea5df2d129 Expand AST node ids to support the lexer tokens and grammar rules 2025-04-02 11:29:09 +02:00
omicron 81be56de33 Fix parse_token to add the correct information to a parse node 2025-04-02 11:29:09 +02:00
omicron ec7d06b135 Fix ast nodes now containing token entry instead of token 2025-04-02 11:29:09 +02:00
omicron 3ff53f923d Partial parser implementation 2025-04-02 11:29:09 +02:00
omicron 4c7555dfd8 Add invalid ast node id 2025-04-02 11:29:09 +02:00
omicron 68a41d035d FIXME REORDER COMMIT -- Change main so it can parse the ast
FIXME THIS COMMIT NEEDS TO BE REORDERED
FIXME THIS COMMIT NEEDS TO BE REORDERED
FIXME THIS COMMIT NEEDS TO BE REORDERED
FIXME THIS COMMIT NEEDS TO BE REORDERED
2025-04-02 11:29:09 +02:00
omicron 4e1186a305 Add basic AST functionality 2025-04-02 11:29:09 +02:00
omicron 34ace36920 Add a parser grammar 2025-04-02 11:28:58 +02:00
omicron 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
omicron 42da7b1d05 Move err_allocation_failed into error.c and make it available to
everyone.
2025-03-31 18:43:34 +02:00
omicron 75fc72c35d Add action to run validation on every commit
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
omicron 5cdb60d395 Remove peek function 2025-03-30 22:51:47 +02:00
omicron e5830daac9 Add documentation comments to the lexer code 2025-03-30 22:51:15 +02:00
omicron 4becfb868e Reduce excessive line length in Makefile 2025-03-30 22:07:35 +02:00
omicron 942dd444cc Fix infinite loop when lexing an invalid newline sequence 2025-03-30 22:03:12 +02:00
omicron 55f6dff543 Add basic fuzzing with afl++ 2025-03-30 22:01:53 +02:00
omicron df948b18c6 Initial commit, basic lexer structure 2025-03-30 17:45:51 +02:00