Welcome to the second devlog of my probably useless for now stack-based scripting language written in Roblox’s Luau. If you haven’t read the first one, you definitely should here.
After creating the lexer, I could finally move on to the parser. The parser takes the list of tokens, goes through them, and creates nodes in an AST (Abstract Syntax Tree) for the interpreter to use. Nodes contain similar data as tokens, like types, values, line, column, but they also contain extra data (for example, the if block, elseif blocks, and else block in if statements, blocks in custom functions). So far, the parser isn’t that complicated. It’s pretty similar to the lexer because I haven’t gotten to anything advanced yet (statements, custom functions, etc.).
In this example, I’ve taken the same input from the previous devlog and got this as an output.
Once again, if you have any feedback, feel free to let me know. I’m also thinking of a name for this, so feel free to suggest one. Thanks for reading!