Do you want to create a programming language?
Well this guide tells you everything you need to make a programming language.
1. Tokens
Tokens hold a type, and sometimes a value.
They would be something like this: INT:10.
And they would be structured something like this: {TYPE}:{VALUE} OR {TYPE}
Keywords
Keywords are certain words that hold a functionality and are tokens.
A var keywords’ token would be something like this KEYWORD:var
2. Lexer
The lexer turns the code into tokens.
Here’s an example:
i have no idea why the indentation is weird, but you see the different token types like T_DEF?
well those tokens determine what function is called, and the function that is called will handle the making of the AST node. Like for example T_DEF indicates that a variable is being assigned and will make a new variable assignment node like this
Assign(var_name, var_value)
(also your right i probably shouldve given this explanation in the original comment, thats mb)