More tests and readme

This commit is contained in:
2025-08-09 20:59:31 +10:00
parent 7364a3ac3e
commit 767cf65016
3 changed files with 46 additions and 0 deletions

36
README.md Normal file
View File

@@ -0,0 +1,36 @@
# Ground - A speedy platform for building cool software
## What is Ground?
Ground is an interpreter which processes and interprets Ground instructions. It is quite fast, and the syntax is simple.
## What are the main features of Ground?
* **Simple syntax:** Ground doesn't have very many features, and that's intentional. It makes Ground easy to learn, and keeps it speedy.
* **Super speed:** Ground code is faster than Python and JavaScript, and nearly as fast as C++ and Rust, while still being interpreted. (Tested using tests/to1000.grnd)
* **Tiny interpreter:** Ground contains 761 lines of code (and 233 lines of comments) at the time of writing, and compiles in seconds.
* **Portable:** Ground's code only uses features from the C++ standard library, using features from C++17 and prior.
## How do I get started?
Clone the repo and compile with your favourite C++ compiler:
```
g++ src/main.cpp -std=C++17 -O3 -o ground
```
(You can omit the -std flag on systems which default to the latest standard, and the -O3 flag if you're fine with a slightly slower interpreter.)
Run a Ground program:
```
./ground tests/input.grnd
```
If you'd like to create your own Ground programs, read the files in the docs/ folder of the repository.
## Contributing
If you want to help out, feel free to clone the repo and send pull requests! All the code is documented.
Feature requests also welcome! Reach out by emailing max at chookspace dot com.

3
tests/exiting.grnd Normal file
View File

@@ -0,0 +1,3 @@
stdlnout "Time to exit Ground! We totally had an error, so there should be a return code of 1"
end 1

7
tests/input.grnd Normal file
View File

@@ -0,0 +1,7 @@
stdout "Do you like cheese? "
stdin &userin
equal $userin "yes" &condition
if $condition %7
stdlnout "That is sad"
jump %1
stdlnout "Awesome! I do too!"