Skip to content
Snippets Groups Projects
Select Git revision
  • 44383df01377211b925a570f35a8d3061608bd0f
  • main default
  • refactor/lexer
  • feat/exponents
4 results

styvejava

Leo's avatar
Leo authored
44383df0
History
Name Last commit Last update
.idea
examples
src
.gitignore
README.md
styve.iml

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.

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

--- 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?

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.

--- 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)

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?

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.

--- 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:

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.