Follows the book https://craftinginterpreters.com/.
Chapters to test names: https://github.com/munificent/craftinginterpreters/blob/01e6f5b8f3e5dfa65674c2f9cf4700d73ab41cf8/tool/bin/test.dart#L599
(instructions for this are already in the repository)
(instructions for this are already in the repository)
https://craftinginterpreters.com/scanning.html#recognizing-lexemes
Same as above, add braces into the mix.
https://craftinginterpreters.com/scanning.html#recognizing-lexemes
,
, .
, -
, +
, ;
, *
.
/
is not covered here, it'll be covered in later stages.
https://craftinginterpreters.com/scanning.html#lexical-errors
,.$(#
Expected output:
COMMA , null
DOT . null
[line 1] Error: Unexpected character.
LEFT_PAREN ( null
[line 1] Error: Unexpected character.
Tester implementation notes:
- Errors must be printed to stderr. The ordering compared to other statements doesn't matter.
- Test errors first, and test stdout tokens after.
- For errors, only test against lines that start with
[line <digit>]
. That way the user can still add other debug statements and not mess with our output. Also compare line-by-line, so that the diffs are easy to parse. - Test exit code too!
https://craftinginterpreters.com/scanning.html#operators
=
, ==
.
https://craftinginterpreters.com/scanning.html#operators
!
&& !=
.
https://craftinginterpreters.com/scanning.html#operators
<
, >
, <=
, >=
.
https://craftinginterpreters.com/scanning.html#longer-lexemes
https://craftinginterpreters.com/scanning.html#longer-lexemes
Now that whitespace is implemented, we can test whether line counting actually works for errors.
https://craftinginterpreters.com/scanning.html#string-literals
"hello"
https://craftinginterpreters.com/scanning.html#number-literals
123
, 123.123
etc.
https://craftinginterpreters.com/scanning.html#reserved-words-and-identifiers
abcd
, foo
, bar
etc.
https://craftinginterpreters.com/scanning.html#reserved-words-and-identifiers
or
, if
etc.