This is an interpreter for a BASIC-like language written in C#.
This code follows the tutorial "Make your own programming language in Python" series on YouTube which is written in Python 3, and this code is rewritten in C#.
Note that there are two Main
functions separated in two files (BasicInterpreter/Example.cs
and BasicInterpreter/Shell.cs
). You may want to comment a file temporary before running another file.
To start with, you can run BasicInterpreter/Example.cs
which runs the BasicInterpreter/example.myopl
file. You may want to set the path to the example.myopl
manually. You can also investigate the grammar rules (syntax) of the language in grammer.txt
.
The other Main
function is in a file called BasicInterpreter/Shell.cs
. You can try programming in the shell when you run the program.
For viewing all the built-in variables and functions that are avaliable, you can read BasicInterpreter/Basic.cs
.
- EP 1 - Lexer
- EP 2 - Parser
- EP 3 - Interpreter
- Bonus - Power operator
- EP 4 - Variables
- EP 5 - Comparisons and logical operators
- EP 6 - If statement
- EP 7 - For and while statements
- EP 8 - Function
- EP 9 - Strings
- EP 10 - Lists
- EP 11 - Built-in functions
- EP 12 - Multi-line statements
- EP 13 - Return, continue, break
- EP 14 - Run statements and comments (finale 🎉)
- Built-in functions
append()
,pop()
, andextend()
do not work because the built-in functions and the actual program use differentContext
. SeeExecute()
inBasicInterpreter/Runtime/BuiltInFunction.cs
andVisit_CallNode()
inBasicInterpreter/Interpreter.cs
.