Skip to content

GypsyDangerous/Cobalt-BASIC

Repository files navigation

Cobalt BASIC

Icon

Cobalt BASIC is a simple, dynamically typed, interpreted programming language with syntax inspired by python and javascript with an aim for readability and understandablility. It is not the fastest langauge ever because it is interpreted by python, but it will get the job done for simple tasks

Files


main.py

  • Contains the shell for running programs in my programming language
  • imports basic.py

basic.py

  • Contains all the code the actual programming language, including the lexer, parser, and interpreter
  • imports string_with_arrows.py, Token.py, Nodes.py, Lexer.py, Errors.py, and Parser.py

string_with_arrows.py

  • Contains a single method called string_with_arrows, for inserting ^ characters where an error appears in the code

Token.py

  • Contains the Token class and all token type constants used in the language

Global_variables.py

  • Contains all global variable for the interpreter

Interpreter.py

Contains all these classes

  • Symbol Table
  • Context
  • Value and subclass
  • RunTime Result
  • Interpreter

Lexer.py

  • Contains the Lexer

Parser.py

Contians all these classes

  • Parse Result
  • Parser

Nodes.py

  • Contains all Node classes

Position.py

  • Contains the position class

Errors.py

  • Contains the Error class and all subclasses

Prerequisites

Python 3.6 or greater

Installation

Currently this project can be run from any python environmment with no special installations, all you need to do is

  1. clone this repo
  2. cd into the directory for the repo
  3. run main.py from your preffered python executor

Todo list

  • add functions
  • add strings
  • add lists
  • fix variable reassignment
  • add built in functions
  • add multi-line code compatability
  • add return statement
  • add iterative for loops
  • add default arguments to functions
  • add *args functions
  • improve anonymous functions
  • add try/except
  • improve lists
  • allow custom object creation
  • add operator overloading to custom objects

Credits

The base of this code was written while following this tutorial series on youtube. I have added some of my own features and syntax. I plan to go beyond this tutorial series and add even more features as I learn more about this topic.

saved tutorials

About

Custom programming language built in python

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages