This post introduces variable declaration to the programming language. The author reorganized the code, creating a new namespace for runtime execution and refactoring Lexer and SyntaxParser classes. Key tokens like `int`, `double`, `string`, and `bool` are introduced as `DataType`, while variable names are `Identifier`. The Lexer now extracts tokens for strings, keywords, identifiers, and symbols. The SyntaxParser has been updated to handle variable declarations, assignments, and string operations. The `Evaluate` method returns a list of `Identifier`s, representing the result of each expression. An example demonstrates variable declaration and the use of a `print` function. The post concludes by stating that each expression is represented by an Identifier.
dev.to
dev.to
Create attached notes ...