Add Lexer API

Valerie Wolfe 2024-04-03 14:47:32 -04:00
parent 9a266e79fa
commit 3a37ed9f3c

27
Lexer-API.md Normal file

@ -0,0 +1,27 @@
The `interpret` helper object exposes the Lexing and Parsing API.
## Methods
### `interpret.first(input: str)`
Peeks the first token in the input string.
Returns: `Token`
### `interpret.input(prompt: str)`
An `input(prompt: str)` wrapper that tokenizes the user input.
Returns: `TokenSet`
### `interpret.parse_roll(input: str)`
Parses `input` using the default roll expression parser.
Returns: `int`
### `interpret.tokenize(input: str)`:
Tokenizes a string.
Returns: `TokenSet`