Commit Graph

18 Commits

Author SHA1 Message Date
mvhutz 335ce95c50 feat: add comment support to saccharine language (#25)
## Description

The saccharine language previously lacked comment support, preventing proper code documentation.
This PR implements '#' comment syntax similar to Python.
Comments can appear on their own line or at the end of a line, with all content after '#' ignored until the next newline or EOF.
The tokenizer now detects '#' and skips characters appropriately without creating tokens.

### Decisions

Comments are silently consumed during tokenization rather than being preserved as tokens, keeping the token stream clean for the parser.
The implementation preserves newlines after comments by using the iterator's Back() method, allowing them to be processed as soft breaks.

## Benefits

Developers can now document their saccharine code with inline and full-line comments.
The implementation is minimal and efficient, adding no overhead to the token stream.
Tests verify that comments work correctly in various positions without breaking code execution.

## Checklist

- [x] Code follows conventional commit format.
- [x] Branch follows naming convention (`<type>/<description>`). Always use underscores.
- [x] Tests pass (if applicable).
- [x] Documentation updated (if applicable).

Closes #24

Reviewed-on: #25
Co-authored-by: M.V. Hutz <git@maximhutz.me>
Co-committed-by: M.V. Hutz <git@maximhutz.me>
2026-01-13 02:00:00 +00:00
mvhutz 2499921679 style: moved functions around 2025-12-30 15:58:14 -05:00
mvhutz 412d3924eb docs: document methods 2025-12-29 20:44:55 -05:00
mvhutz aabe92f2dc fix: cannot omit final newline 2025-12-29 20:17:50 -05:00
mvhutz ee9e71d58e fix: no ds store 2025-12-28 02:07:46 -05:00
mvhutz 0945cedf51 feat: only compute all free variables during a-conversion 2025-12-28 02:07:14 -05:00
mvhutz 4d81aca0b2 feat: fun little program 2025-12-28 00:53:43 -05:00
mvhutz f038d0a685 feat: parse saccharine, conversion incoming 2025-12-27 23:36:44 -05:00
mvhutz 14fc4b30da feat: cleaner parsing functions 2025-12-27 20:46:10 -05:00
mvhutz c37e96770f feat: tokenizer accepts braces, line terminator, and equal sign 2025-12-27 19:52:18 -05:00
mvhutz 0e185fbf41 feat: expression 2025-12-27 03:43:19 -05:00
mvhutz bf0edfc593 style: renamed token index to column 2025-12-27 02:43:17 -05:00
mvhutz 1896cd652d feat: better error messages 2025-12-27 02:39:56 -05:00
mvhutz 884180de92 feat: error for when there is more source code than parsed 2025-12-27 02:08:18 -05:00
mvhutz 5841023dde fix: no log errors 2025-12-27 01:18:52 -05:00
mvhutz a05a63627e feat: better recursive descent 2025-12-27 01:18:06 -05:00
mvhutz e3629acb45 feat: stuff 2025-12-26 03:37:05 -05:00
mvhutz d427703afe wip: new folder structure, overhaul language 2025-12-26 02:39:15 -05:00