Skip to content

Interpreter

Nathan edited this page Mar 7, 2020 · 1 revision

The interpreter can be broken down into 5 distinct layers

  1. Importer
  2. Scanner
  3. Parser
  4. Resolver
  5. Interpreter

Importer

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.

Scanner

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.

Parser

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.

Resolver

The Resolver, well, resolves. It takes all the statements and expressions spit out by the parser and connects the dots.

Interpreter

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#.

Clone this wiki locally