ShadowScript is a Python-based interpreter designed for a custom scripting language. It provides a versatile environment for executing scripts with various features like variable declarations, arithmetic operations, conditional statements, and loops.
To use ShadowScript, simply clone this repository and ensure you have Python installed on your system or test this code in a VM environment, provided in the description of this repository.
ShadowScript consists of several key components:
Lexer
: Tokenizes the input script into meaningful tokens.Parser
: Parses the tokens into an abstract syntax tree (AST).Interpreter
: Interprets the AST and executes the script.Data
: Handles storage and retrieval of variables.
ShadowScript: make x = 10
ShadowScript: make y = 20
ShadowScript: x + y
This example demonstrates declaring two variables and performing an addition operation.
ShadowScript: make a = 5
ShadowScript: make b = 10
ShadowScript: if a < b do a = a + 1
This example shows the use of a conditional if
statement to modify a variable based on a comparison.
ShadowScript: make counter = 0
ShadowScript: while counter < 5 do make counter = counter + 1
In this example, a while
loop is used to increment a variable until a certain condition is met.
ShadowScript is a basic interpreter and may not support all features of a fully-fledged programming language. It's primarily for educational and experimental purposes.