17 Commits

Author SHA1 Message Date
000756fca9 More grammar
All checks were successful
Validate the build / validate-build (push) Successful in 27s
2025-04-02 15:39:41 +02:00
ccf8f52b6e add functionality to main to parse and print the ast 2025-04-02 13:00:01 +02:00
35c471f8d4 Partial parser implementation 2025-04-02 12:59:55 +02:00
44fab4c678 Fix incorrect size comparison in lexer_consume_n
The buffer length len and the requested number of tokens n are mixed up
in an invalid comparison. This causes all valid requests for n < len
tokens to be denied and all invalid requests for n > len tokens to be
accepted. This may cause a buffer overflow if the caller requests more
characters than they provide space for.
2025-04-02 12:59:55 +02:00
bcc1569b39 Add a parser combinator to parse a delimited list 2025-04-02 12:59:55 +02:00
5746ef1c5a Add basic parser combinators 2025-04-02 12:59:51 +02:00
2cab530eed Add "primitive" parsers for all the non-trivia tokens in the lexer grammar 2025-04-02 12:59:47 +02:00
7ac4eac37f Add basic parser utilities 2025-04-02 12:59:41 +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
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
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
942dd444cc Fix infinite loop when lexing an invalid newline sequence 2025-03-30 22:03:12 +02:00
df948b18c6 Initial commit, basic lexer structure 2025-03-30 17:45:51 +02:00