Commit Graph

4 Commits

Author SHA1 Message Date
Bob Nystrom
c72db7d594 feat: rename IO.write to IO.print and add Unicode escape support in strings
Rename the IO.write method to IO.print, which now prints without a trailing newline, and add a new IO.print method that appends a newline after output. Update all benchmark, example, and test files to use IO.print instead of IO.write. Additionally, implement Unicode escape sequence parsing in the compiler's string tokenizer, supporting \uXXXX and \u{...} syntax with proper UTF-8 encoding for code points up to U+10FFFF.
2014-01-05 20:27:12 +00:00
Bob Nystrom
8bb1a94a25 refactor: convert IO from singleton instance to static class with metaclass native methods
Replace the global `io` singleton object with a static `IO` class, moving the `write` native from the instance to the metaclass. Update all benchmark, example, and test files to use `IO.write()` instead of `io.write()`.
2013-12-22 03:25:09 +00:00
Bob Nystrom
643a7c4f97 feat: add logical OR operator with short-circuit evaluation and token support
Add TOKEN_PIPEPIPE token for '||' syntax, implement or() parsing function with CODE_OR bytecode, and add VM interpreter logic that short-circuits on truthy left operand. Update .gitignore to exclude *.xccheckout files, extend test coverage for falsy behavior in and.wren and if.wren, and add comprehensive or.wren test suite verifying short-circuit semantics and truthiness rules.
2013-11-20 02:24:58 +00:00
Bob Nystrom
9e8eed6c29 feat: implement logical AND operator with short-circuit evaluation and new CODE_AND instruction
Add TOKEN_AMPAMP token to the lexer for parsing '&&' operator, introduce PREC_LOGIC precedence level for proper expression parsing, implement the `and()` compiler function that emits CODE_AND with a patchable jump offset, and add runtime support in the VM with IS_FALSE macro for truthiness checking. Include comprehensive test cases in test/and.wren verifying short-circuit behavior and return values.
2013-11-19 15:35:25 +00:00