Skip to content

Interpreter for a BASIC-like language written in C#

Notifications You must be signed in to change notification settings

you3o3/basic-interpreter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BASIC Interpreter

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.

Progress Checklist

  • 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 🎉)

Known Issues

  1. Built-in functions append(), pop(), and extend() do not work because the built-in functions and the actual program use different Context. See Execute() in BasicInterpreter/Runtime/BuiltInFunction.cs and Visit_CallNode() in BasicInterpreter/Interpreter.cs.

About

Interpreter for a BASIC-like language written in C#

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages