harbor run -t openthoughts/tasktrove-mix-h7-raw-volume-5k-v2-mix-h7-raw-volume-3146harbor download openthoughts/tasktrove-mix-h7-raw-volume-5k-v2-mix-h7-raw-volume-3146Implement a Hy language lexer/tokenizer and related error handling so the provided test suite can run and pass. Place your solution under /app/.
What to build
A tokenizer function that parses a Hy source string and returns a list of Hy model objects (HyExpression, HyInteger, HyFloat, HyComplex, HySymbol, HyString, HyDict, HyList, HySet, HyKeyword). The function is the public API:
Lexical exception classes to be raised by the tokenizer for error conditions:
A Hy-specific exception/tracing helper that filters Python tracebacks to present only user-facing frames:
Summary of tokenizer behavior and expected token details
Basic forms
Atomic tokens
Digit separators: underscore and comma can appear within numeric tokens and must be ignored when determining numeric value. Mixed separators should be supported. However, sequences that make token ambiguous (e.g., starting with separators) should become symbols (see leading underscore case below). Also allow separators in hex/bin/oct literals (e.g., 0x_af).
Token attribute tracking: every compound token (HyExpression and other returned Hy model objects) must have location metadata:
Comments: semicolon ';' begins a comment that runs to the end of the line. Comments should be ignored by the tokenizer.
Discard operator: #_ should discard the next complete form/token from the resulting token list. This operator:
Tag macro: tokenize tag macro forms (e.g., starting with "#^") so that they are represented as an expression whose first element is a HySymbol("dispatch-tag-macro"), the second element is a HyString with the tag text (e.g., "^"), and there are the expected additional parts. (In other words, the tag macro is rewritten into a form whose head is "dispatch-tag-macro" and whose second element is a string token containing the tag.)
Attribute access syntax and errors
Unbalanced/unterminated input
Error messages and formatting
Miscellaneous
Files and symbols to create
/app/hy/lex.py
/app/hy/lex/exceptions.py
/app/hy/errors.py
Behavioral examples (high-level)
Notes and hints
Place your implementation files under /app/ as described above so the test runner can import hy.lex.tokenize, hy.lex.exceptions, and hy.errors.hy_exc_handler.