Files
highground-fork/README.md

98 lines
1.5 KiB
Markdown
Raw Normal View History

2025-12-20 15:29:18 +11:00
![](https://chookspace.com/max/solstice/raw/branch/master/logo/solstice.png)
2025-12-20 15:09:09 +11:00
# Solstice
2025-12-14 21:15:30 +11:00
2025-12-20 15:09:09 +11:00
Solstice is a programming language based on Ground.
2025-12-14 21:15:30 +11:00
## Compiling
First, ensure CGround is installed on your system with `sudo make install`. Then, compile with
```
2025-12-20 15:09:09 +11:00
g++ src/main.cpp -o solstice -lgroundvm
2025-12-14 21:15:30 +11:00
```
## Usage
2025-12-20 15:09:09 +11:00
Solstice files use the `.sols` extension. Run files as you would with any other interpreted language.
2025-12-14 21:15:30 +11:00
2025-12-20 15:09:09 +11:00
## Using Solstice
2025-12-14 21:15:30 +11:00
### Types
* `int`: Ground int (64 bit integer) eg 3, 7, 31432
* `double`: Ground double (Double precision floating point) eg 3.141, 2.7
* `string`: Ground string (char*) eg "Hello, World"
* `char`: Ground char (char) eg 'a'
* `bool`: Ground bool (either true or false)
### Printing
Prefix an expression with `puts` to print it to the console.
```
puts "Hello, world!"
puts 3.141
puts 7
puts 'a'
puts true
```
### Math
Add numbers with `+` (more operations coming soon)
```
puts 1 + 1
puts 3.14 + 2.7
puts 532 + 314 + 89432
```
2025-12-20 14:47:24 +11:00
### Comparisons
Compare 2 values with `==` and `!=` (more operations coming soon)
```
puts 5 == 5
puts 5 != 5
puts "dingus" == "dongus"
puts "dingus" != "dongus"
```
### Variables
Set a variable with `=`, similar to Python.
```
x = 5
y = 10
puts x + y
```
### Control Flow
Use `if` to execute code if a condition is true.
```
password = "dingus"
if password == "password123" {
puts "Your password is insecure."
}
2025-12-20 15:09:09 +11:00
if password == "dingus" {
2025-12-20 14:47:24 +11:00
puts "Cool password!"
}
```
Use `while` to loop over a statement.
```
number = 0
while number != 10 {
number = number + 1
puts number
}
```