-
Notifications
You must be signed in to change notification settings - Fork 2
Interpreter
The interpreter can be broken down into 5 distinct layers
- Importer
- Scanner
- Parser
- Resolver
- Interpreter
The importer scans the source for preprocessing tokens. At the moment, this is only the import token. The importer recursively checks the new content for more imports, then inserts any imported file's code directly in place of the import token. I plan on having the imported code just get interpreted. That's kind of interpreter whole shtick! I additionally plan on making the importer able to check if an import has already been made.
The Scanner reads through the source and tokenizes it. It shreds the code into a big ol list of operators, keywords, and literals. That's about it.
The Parser is where the language starts to be spoken. All the tokens from before get shaken about until they look like an abstract syntax tree.
The Resolver, well, resolves. It takes all the statements and expressions spit out by the parser and connects the dots.
The Interpreter has the (arguably) easier job of taking all that intermediate code and throwing C# at it to actually execute. And that's how you go from some syntax I called Basil to C#.