Commit Graph

31 Commits

Author SHA1 Message Date
seeseemelk 4bd66ea216 More variable stuff 2026-04-30 20:25:53 +02:00
seeseemelk 0704284726 Can parse variables 2026-04-29 21:39:48 +02:00
seeseemelk f260e02efa Refactor parser 2026-04-29 20:15:05 +02:00
seeseemelk 1c5d49d682 Fix valgrind errors 2026-04-29 19:41:00 +02:00
seeseemelk 1f40c8f5ee Refactor tests a bit more 2026-04-29 13:25:41 +02:00
seeseemelk 98d58a2169 Refactor tests 2026-04-29 13:09:14 +02:00
seeseemelk 84747028f5 Ensure alias and import can be mixed 2026-04-29 11:46:02 +02:00
seeseemelk f90cad2b96 Use proper public keyword 2026-04-29 11:43:14 +02:00
seeseemelk 9035cc639c Add alias to ast 2026-04-29 11:18:40 +02:00
seeseemelk 3288efdfd7 Refactor test interface 2026-04-29 10:59:06 +02:00
seeseemelk 146aa4d9d1 Convert codebase to C89 compatibility and update test scripts 2026-04-29 10:21:29 +02:00
seeseemelk 05dfb3725b fix: replace unsafe fixed-size buffers with dynamic formatting helpers; add util format helpers; centralize log_on_line cleanup 2026-04-26 22:42:10 +02:00
seeseemelk 129036b539 Fix all valgrind errors 2026-04-26 22:13:39 +02:00
seeseemelk 9449f16e02 Implement tokenstream_get_test and simplified assert_log_file using test names 2026-04-26 20:31:17 +02:00
seeseemelk e910c01348 Refactor golden files to follow xyz_log_ and xyz_src_ naming convention 2026-04-25 20:05:16 +02:00
seeseemelk 63dd5fa5c9 Implement public import parsing and add test case 2026-04-25 15:06:20 +02:00
seeseemelk 91593e12b7 Add error logging and corresponding tests for parser syntax errors 2026-04-25 14:37:08 +02:00
seeseemelk 7c7e0c3272 Add import parsing
Co-authored-by: Copilot <copilot@github.com>
2026-04-25 14:30:11 +02:00
seeseemelk a89e61eedd Introduce golden file mechanism for tests 2026-04-24 21:09:47 +02:00
seeseemelk 9ca72ef5bf Split test 2026-04-24 20:41:57 +02:00
seeseemelk 0306530fe8 Better logging in tokenstream 2026-04-24 20:40:31 +02:00
seeseemelk 451a9a2a22 Token refactor and better logs 2026-04-24 20:28:08 +02:00
seeseemelk e021a2d63e During test, log to in-memory log 2026-04-24 20:04:00 +02:00
seeseemelk 0e826e05e1 Add log framework 2026-04-24 15:14:15 +02:00
seeseemelk 0fa7b599ed Implement assert_str and assert_not_null and update tests 2026-04-24 14:57:52 +02:00
seeseemelk a173e37adc Implement parser module and update AST 2026-04-24 14:50:54 +02:00
seeseemelk b6aaa0c08f Implement tokenstream_info and refactor TokenStream interface 2026-04-24 14:28:57 +02:00
seeseemelk 49b9db5b75 Refactor token mapping: use keyword map for tokenization instead of strcmp
- Created KeywordMap structure with keyword-to-token mapping at top of token.c
- Added lookup_keyword() function to check if identifier is a keyword
- Replaced 3 strcmp calls (lines 99-101) with single lookup_keyword() call
- Removed token_to_string() function and its tests (3 tests removed)
- Single easy-to-read and modify keyword map serves both documentation and implementation
- Added new keywords by editing the keywords[] array at top of token.c

All 12 tests passing (removed token_to_string tests which are now unnecessary).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-24 09:44:19 +02:00
seeseemelk dccdcb8ba5 Implement token.c with comprehensive tests and easy-to-modify token mapping
- Created token-to-string mapping array parallel to Token enum in token.c
- Implemented TokenStream with lookahead buffering for proper tokenization
- Implemented tokenstream_open/close/next functions with support for:
  - Keywords (module, import, void)
  - Symbols (parentheses, brackets, comma, semicolon)
  - Identifiers (alphanumeric starting with letter or underscore)
  - Comment skipping (// style)
  - Whitespace handling
- Added token_to_string function to token.h for token inspection
- Created comprehensive test suite (15 tests) covering all token types and edge cases
- All tests pass.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-24 09:35:18 +02:00
seeseemelk c73f99d9e6 Project setup 2026-04-24 09:29:53 +02:00
seeseemelk 4939a74752 Update test paths after flattening v0 layout
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-24 08:20:54 +02:00