Implement strings and partial implementation of arrays (missing index expr eval)

Signed-off-by: jmug <u.g.a.mariano@gmail.com>
This commit is contained in:
Mariano Uvalle 2025-01-10 17:48:54 -08:00
parent a76f47a7a3
commit 59acf6b1a1
13 changed files with 388 additions and 20 deletions

View file

@ -13,6 +13,7 @@ const (
PRODUCT // *
PREFIX // -X or !X
CALL // myFunction(X)
INDEX // array[index]
)
var precedences = map[token.TokenType]int{
@ -25,6 +26,7 @@ var precedences = map[token.TokenType]int{
token.ASTERISK: PRODUCT,
token.SLASH: PRODUCT,
token.LPAREN: CALL,
token.LBRACKET: INDEX,
}
func (p *Parser) peekPrecedence() int {