Commit Graph

3 Commits

Author SHA1 Message Date
Bob Nystrom
769e604dd1 feat: restructure compiler to bottom-up order removing forward declarations
Eliminate all forward declarations and reorder functions so each is defined before its first use, making recursion points explicit. Add semicolon counting to metrics script and include boolean equality test file.
2013-11-07 15:04:25 +00:00
Bob Nystrom
46977dceea feat: replace block syntax with fn keyword for function literals across compiler and tests
Rename `block` parsing rule to `fn` by adding TOKEN_FN token and function prefix rule, removing the old block prefix from TOKEN_LEFT_BRACE. Update compiler.c to replace `block()` with `function()` and add fn equality primitives (fn_eqeq, fn_bangeq) in primitives.c. Migrate test files: rename block_call.wren to fn_call.wren, block_syntax.wren to fn_syntax.wren, and replace `{ ... }` with `fn { ... }` or `fn expr` syntax. Remove obsolete bool_equality.wren test.
2013-11-06 15:47:47 +00:00
Bob Nystrom
8353c26596 feat: add == and != operators for bool, number, and string types with type-checking
Implement equality and inequality operators across three primitive types in the compiler and runtime. Add `bool_eqeq`/`bool_bangeq`, `num_eqeq`/`num_bangeq`, and `string_eqeq`/`string_bangeq` primitives that return false/true respectively when comparing against incompatible types. Update the parse rule table with `INFIX_OPERATOR` macros for `TOKEN_EQEQ` and `TOKEN_BANGEQ` at `PREC_COMPARISON` precedence. Include test files `bool_equality.wren`, `number_equality.wren`, and `string_equality.wren` covering cross-type comparisons and edge cases.
2013-11-05 17:57:57 +00:00