From 767cf650169cf47b331cd0365805298ac2c297aa Mon Sep 17 00:00:00 2001 From: Maxwell Jeffress Date: Sat, 9 Aug 2025 20:59:31 +1000 Subject: [PATCH] More tests and readme --- README.md | 36 ++++++++++++++++++++++++++++++++++++ tests/exiting.grnd | 3 +++ tests/input.grnd | 7 +++++++ 3 files changed, 46 insertions(+) create mode 100644 README.md create mode 100644 tests/exiting.grnd create mode 100644 tests/input.grnd diff --git a/README.md b/README.md new file mode 100644 index 0000000..a0f2dda --- /dev/null +++ b/README.md @@ -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. diff --git a/tests/exiting.grnd b/tests/exiting.grnd new file mode 100644 index 0000000..ff6fde6 --- /dev/null +++ b/tests/exiting.grnd @@ -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 diff --git a/tests/input.grnd b/tests/input.grnd new file mode 100644 index 0000000..9c1fc16 --- /dev/null +++ b/tests/input.grnd @@ -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!"