Skip to content
Snippets Groups Projects
Commit af7abe85 authored by Leo's avatar Leo
Browse files

fix: readme and examples

parent ff4522b4
No related branches found
No related tags found
No related merge requests found
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Main" type="Application" factoryName="Application" nameIsGenerated="true">
<option name="MAIN_CLASS_NAME" value="Main" />
<configuration default="false" name="Styve" type="Application" factoryName="Application" nameIsGenerated="true">
<option name="MAIN_CLASS_NAME" value="Styve" />
<module name="styve" />
<option name="PROGRAM_PARAMETERS" value="examples/07_objects.styve" />
<method v="2">
......
README.md 0 → 100644
# StyveJava - Styve - Teachers Choice Interpreted Language
## Welcome to Arne Styve
So, you think you’re a programmer? **Arne Styve** is here to challenge that notion. This is not your ordinary programming language. It’s confusing, unnecessarily difficult, and designed to make you question every decision you’ve ever made. Only the truly dedicated (or foolish) will emerge victorious, having mastered the arcane syntax and unconventional rules.
Do you love making things harder for yourself? Then Arne Styve is for you.
## Features
- **Unnecessarily Complex Syntax**: Why use a simple `;` when you can use **"Styve"**? Why make things readable when you can introduce chaos?
- **Mysterious Functionality**: Even basic operations might do something unexpected. That's half the fun.
- **Scope? Good Luck**: Variables exist. Constants are eternal. Where they live is for you to figure out.
- **Bragging Rights**: If you can successfully write and run an Arne Styve program, you’ve earned the right to be smug.
## Installation
Arne Styve isn't for the faint of heart. Get it running, and you're already winning.
```bash
git clone https://gitlab.stud.idi.ntnu.no/leo/styvejava.git
cd styvejava
# Compile the Java files
javac -d bin src/**/*.java
# Run the Styve class
java -cp bin Styve examples/01_hello.styve
```
Just make sure Java is installed.
## Getting Started (Or Giving Up)
Here's a "simple" example to get you started—or stuck.
### Defining Variables
```styve
--- This is a mutable variable. Good luck.
Arne Arne Arne a Arne 42 Styve
--- Yeah, constants exist but dont expect mercy.
Arne Arne Styve pi Arne 3.14159 Styve
```
### Functions
Because why not let your brain melt trying to read this?
```styve
Arne Arne Styve Arne Arne insanity (mind) 8=
STANDUP("Welcome to Arne Styve,", mind) Styve
=D Styve
insanity("Developer") Styve
```
### If-Statements
Good luck getting this to behave like you'd expect.
```styve
--- Determine if a number is positive, negative or zero
Arne Arne Arne number Arne -10 Styve
Arne? (number Overflow 0) 8=
STANDUP("Number is positive") Styve
=D Styve? Arne? (number Samesies 0) 8=
STANDUP("Number is zero") Styve
=D Styve? 8=
STANDUP("Number is negative") Styve
=D Styve
```
### Object and Array Access (We Dare You)
```styve
Arne Arne Arne obj Arne 8=
name Kanban "Chaos",
age Kanban 1000
=D Styve
STANDUP(obj Arne Styve name) Styve
Arne Arne Arne arr Arne .1, "two", 3. Styve
STANDUP(arr Ransak 1) Styve
STANDUP(arr Ransak 0) Styve
STANDUP(arr Ransak -1) Styve
--- Stua is the element in the middle of the array.
STANDUP(arr Ransak Stua) Styve
--- Loftet is the first element in the array.
STANDUP(arr Ransak Loftet) Styve
--- Kjelleren is the last element in the array.
STANDUP(arr Ransak Kjelleren) Styve
--- To let the array arr rest, we can use the following command.
arr Arne Styve kaffePause() Styve
--- And the array arr will now do what you expect it to do.
STANDUP(arr Ransak 1) Styve
STANDUP(arr Ransak 0) Styve
```
Nesting objects, thats fun. Right?
```styve
Arne Arne Arne person Arne 8=
name Kanban "Arne Styve",
age Kanban 47,
greet Kanban Arne Arne Styve Arne Arne() 8=
STANDUP("Hello, I am", yoink Arne Styve name + "!") Styve
STANDDOWN("I am", yoink Arne Styve age, "years old") Styve
=D,
innerObj Kanban 8=
innerName Kanban "Arnes child",
innerAge Kanban pappa Arne Styve age - 22,
innerGreet Kanban Arne Arne Styve Arne Arne () 8=
STANDUP("Hello, I am", yoink Arne Styve innerName + "! My parent is", pappa Arne Styve name) Styve
STANDUP("I am", yoink Arne Styve innerAge + " years old") Styve
STANDDOWN("Our age difference is", pappa Arne Styve age - yoink Arne Styve innerAge) Styve
=D
=D
=D
person Arne Styve greet() Styve
person Arne Styve innerObj Ransak "innerGreet" () Styve
```
### Loops
Good luck getting this to behave like you'd expect.
```styve
--- Print numbers from 1 to 10
Arne Arne Arne array Arne .1, 2, 3, 4, 5, 6, 7, 8, 9, 10. Styve
Gjenta Arne Arne Arne i Arne 0 Styve i Underflow array Arne Styve antall Styve i++ 8=
Arne Arne Arne elem Arne array Ransak i Styve
array Arne Styve kaffePause() Styve
STANDUP(elem) Styve
=D
```
Flatten an array of arrays:
```styve
Arne Arne Styve Arne Arne flattenArray (array, row) 8=
Gjenta Arne Arne Arne i Arne 0 Styve i Underflow array Arne Styve antall Styve i++ 8=
Arne Arne Arne elem Arne array Ransak i Styve
array Arne Styve kaffePause() Styve
Arne? (Array Arne Styve ArneArray(elem)) 8=
flattenArray(elem, row) Styve
row++ Styve
=D Styve? 8=
STANDUP("Element", row + ":" + i, "=", elem) Styve
=D
=D
=D
Arne Arne Styve arr Arne ..1, .2, 3, 4., 5., .6, 7, 8., .9, 10.. Styve
STANDUP("Flattening array:", arr) Styve
flattenArray(arr, 0) Styve
```
### Debugging? Haha.
If you can call it that.
Pass `-p` to the interpreter to print the AST.
Pass `-pp` to the interpreter to print the reconstructed source code with syntax highlighting.
pass `--debug` to the interpreter to print the AST and show debug information.
## Mastering the Madness
Arne Styve isn’t just a language—it’s a test of endurance. Conquer the bizarre syntax, obscure functions, and the ever-elusive scope, and you might just call yourself a **Styve Master**.
If you manage to run a working program, you are officially a legend.
## Contributing
Think you can make Arne Styve worse? We welcome your twisted mind.
1. Fork the repo (if you dare)
2. Create a branch for your madness (`git checkout -b feature/ChaosFeature`)
3. Commit your disaster (`git commit -m 'Add ChaosFeature'`)
4. Push (`git push origin feature/ChaosFeature`)
5. Open a merge request and unleash your chaos upon the world
## License
MIT License, but with extra confusion.
---
Welcome to the Styve side. You're going to need a lot of patience. Or maybe just some luck.
\ No newline at end of file
......@@ -4,7 +4,7 @@ Arne Arne Styve Arne Arne flattenArray (array, row) 8=
array Arne Styve kaffePause() Styve
Arne? (Array Arne Styve ArneArray(elem)) 8=
flattenArray(elem, row) Styve
row Styve
row++ Styve
=D Styve? 8=
STANDUP("Element", row + ":" + i, "=", elem) Styve
=D
......@@ -14,6 +14,5 @@ Arne Arne Styve Arne Arne flattenArray (array, row) 8=
Arne Arne Styve arr Arne ..1, .2, 3, 4., 5., .6, 7, 8., .9, 10.. Styve
STANDUP("Flattening array:", arr) Styve
STANDUP("Center of array:", arr Ransak Stua) Styve
flattenArray(arr, 0) Styve
--- STANDUP(globalEnv) Styve
\ No newline at end of file
# StyveJava - Styve - Teachers Choice Interpreted Language
**TODO: Add a description of the language here**
\ No newline at end of file
import frontend.Performance;
import frontend.ast.ASTPrettyPrinter;
import frontend.ast.ProgramStmt;
import frontend.lexer.CodeReconstructor;
import frontend.lexer.Lexer;
......@@ -8,7 +7,6 @@ import runtime.Interpreter;
import runtime.environment.Environment;
import java.io.IOException;
import java.lang.reflect.Array;
import java.nio.file.Files;
import java.nio.file.NoSuchFileException;
import java.nio.file.Path;
......@@ -18,7 +16,7 @@ import java.util.List;
import frontend.Constants.Colors;
public class Main {
public class Styve {
public static boolean validateFileExtension(String filename) {
String[] validExtensions = {".styve", ".sty", ".asty"};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment