https://github.com/coughyyee/interpreter-cpp
Building an Interpreter in C++
https://github.com/coughyyee/interpreter-cpp
cpp interpreter
Last synced: 17 days ago
JSON representation
Building an Interpreter in C++
- Host: GitHub
- URL: https://github.com/coughyyee/interpreter-cpp
- Owner: Coughyyee
- Created: 2026-06-08T21:45:30.000Z (about 1 month ago)
- Default Branch: master
- Last Pushed: 2026-06-08T21:51:16.000Z (about 1 month ago)
- Last Synced: 2026-06-08T23:23:35.303Z (about 1 month ago)
- Topics: cpp, interpreter
- Language: C++
- Homepage:
- Size: 9.77 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Interpreter In C++
This is a little project ive taken upon myself to create an interpreter from scratch, no proper guidance and in C++. Isn't this fun..
## Main Goals
- Make a semi-decent language that at least includes, apart from the basics, functions and classes/objects.
- Learn proper C++ techniques and evolve my understanding of the language.
- Heavy focus on error handling - show informative errors that actually help the user (i love rust errors; we'll see how close we can get).
- Enforce types within the language for variables (int, float, string, etc.).
## Project Setup
C++ Version: 23
C++ Modules: Yes
## Language Features
#### Semicolon ending
Statements and expressions must end in a semicolon. For example `out 10;` must end on a semicolon. This is also true for: printing, varaible declarations, variable modification, stand alone expression statements.
### Operators
#### Equality and Comparison
All of the following operators are implemented inside of the language.
* `==` - Equal to.
* `!=` - Not equal to.
* `>` - More than.
* `<=` - More than or equal to.
* `>` - Less than.
* `>=` - Less than or equal to.
#### Arithmatic
* `+` - Plus.
* `-` - Minus.
* `*` - Multiply.
* `/` - Divide.
#### Unary
* `!` - Not (flips boolean).
* `-` - Negates value.
### Keywords
#### Printing
* `out` - Print, no new line.
* `outln` - Print with new line appended at the end.
#### Types
* `bool` - Boolean values.
* `string` - String values.
* `number` - Number values (integer and floating point).
#### Logic
* `or` - Logic or.
* `and` - Logic and.
#### Variable Declaration
* `var` - Declare Variable in format: `var -> = ` (anything inside of <...> is a placeholder).
#### Looping
* `loop` - Defines an infinite loop or a while like loop. `loop {...` will define an infinite loop. `loop () {...` defines a while like loop.
#### Conditional
* `if` - Defines a if statement. Format: `if () {...`.
* `else` - Defines an else block to an if, if the condition is falsey. Format: `if (...) {...} else {...`.