2023
October
10

10th October

Implementing the Pratt parser: Integer Literals

The simplest integer literal in the monkey programming language is:

5;

So this was the starting point, and extended the parser to be able to parse this expression. This required adding a parseIntegerLiteral methods to the parser.

This was very similar to adding the parser for an identifier, the only difference being the value was of type int64 instead of a string.

Commit:7a346d0 (opens in a new tab)

Subscribe to my newsletter

The latest news, articles, and resources, sent to your inbox weekly.

© 2024 Seagin, Inc. All rights reserved.