692 B
692 B
DECISIONS (append-only, shared)
D-LEX-1: Token representation
Chose __slots__-based class over dataclass or namedtuple. Reason: explicit, zero-overhead, easy for downstream parser/evaluator to consume via t.kind / t.value without import coupling.
D-LEX-2: Number regex
r"\d+\.?\d*|\.\d+" handles integers, trailing-dot floats (10.), leading-dot floats (.5), and standard floats (3.14). The alternation order matters: \d+\.?\d* before \.\d+ so integers match first.
D-LEX-3: int vs float distinction
int(raw) when no . in the matched string; float(raw) otherwise. Preserves the plan's requirement that 42 yields int value and 3.14 yields float value.