holySHI is a simple, custom programming language designed for educational purposes. It features basic integer variable declarations, arithmetic operations, and print functionality.
- Variable declaration using
summonsoul
(supports only integer values right now). - Arithmetic operations (
+
,-
,*
,/
). - Print statements using
chant
.
The holySHI language uses the .hshi
file extension for its source files.
Write your holySHI code in a file with the .hshi
extension. For example, create a file named example.hshi
:
summonsoul a = 10;
summonsoul b = 20;
summonsoul sum = a + b;
chant(sum);
To compile and run your holySHI code, follow these steps:
g++ -o holySHI main.cpp
./holySHI example.hshi
For the example.hshi
file, the output will be:
30
The lexer tokenizes the source code into tokens. Each token is categorized into different types, such as Keyword, Identifier, Assignment, Number, String, Plus, Minus, Multiply, Divide, Modulus, Equal, LessThan, GreaterThan, LessEqual, LParen, RParen, Eol.
The parser processes the tokens and builds an Abstract Syntax Tree (AST). It supports parsing statements and expressions, including variable declarations and arithmetic operations.
The code generation phase translates the AST into executable code. Currently, it generates C++ code as an intermediate step, which is then compiled and executed.
lexer.h
: Contains the definitions for tokens and the lexer structure.lexer.cpp
: Implements the lexer for tokenizing the source code.AST.cpp
: Contains the definitions for the Abstract Syntax Tree (AST) nodes.Parser.cpp
: Implements the parser for generating the AST from tokens.codeGeneration.cpp
: Implements the code generation from the AST to C++ code.main.cpp
: The entry point for the holySHI interpreter.
git clone https://github.com/YourUsername/holySHI.git
cd holySHI
BUILD:
g++ -o holySHI main.cpp
RUN:
./holySHI <filename>.hshi
Contributions are welcome! Please fork the repository and submit pull requests for any enhancements or bug fixes.
I was inspired to create this language by the work of Terry A. Davis, the creator of HolyC and TempleOS. Thank you, Terry, for your groundbreaking contributions and inspiration.