Giter Club home page Giter Club logo

ahhh's Introduction

AHHH: a programming language for the dreadful

Screaming into the Void but make it Turing Complete

AHHH is an esoteric programming language inspired by the all-consuming dread induced by programming.

SpoOoOoOoKy

Programming languages can shape everything about an algorithm, from its speed, effiency, and modularity all the way down to its aesthetics. In that vein, I wanted to write a programming language that was an absolute bitch to use. Just the absolute worst. A miserable experience for everyone involved. I think - in that goal - I have succeeded. Good luck...

Setup

To compile the interpreter, run:

g++ -Wall interpret_ahhh.cpp -o AHHH

Then, to run files, just call the executable with:

./AHHH file.ahhh

If you aren't using linux you either:

  1. already know how to compile c++ code on your machine, or
  2. should probably use an IDE. Here's a pretty good guide.

I've provided a number of demo files:

  • fib.ahhh
    • Explicitly generates the first ~46 Fibonacci numbers. I stopped at 46 because any larger yields overflow, since I'm using c++ ints. I could fix that, but I won't.
  • fib_inf.ahhh
    • Loops through infinitely many Fibonacci numbers. It overflows basically immediately, but the implimentation is kind of cool (and well documented).
  • hello_world.ahhh
    • You know I had to do it to 'em.
  • hello_world_expanded.ahhh
    • You know what it does, and now you know why. Same program, just with documentation.

The expanded hello world program is only 150 lines of code, but in condensed form is actually quite simple:

AHHHHhhHHHhHHHHhHHHhHHhHHHhHHhhHHhhHHhhHHhhHHhhHHhhHHhhHHhhHhHhhHhhhhhhHHhhHHHhHHHHhHHHhHHhHhHHhhHhhhHhhHhHhHhHhHhHhHhhhhhhHhHhhHhhHHhhHHhhHHhhHhHhhHhhhhhhHhHhhhHhhHhhhhhhHhHhhhHhhHhhHHhhHHhhHHhhhhhhHHhhHHHhHHHHhHHHhHHhHhHhHHHhhHhhHHHhHHHHhHHHhhHHHhHhHHhHhHhHhHhHhHhHhHhhhhhhHHhhHHHhHHHHhHHHhHHhHHhhhhhhHHhhHHHhHHHHhHHHhHHhHHHhHhHhHHHhhHhhHHHhHHHHhHHHhhHHHHHhhHhhHHHhHHHhHHHhHhHHHhHhHHhHhHhhhhhhHhHhhHhhHHhhHHhhHhHhhHhhhhhhHhHhhhHhhHhhHHhhHHhhHHhhhhhhHhHhhHhHhHhHhHhHhhHhhHhhhhhhHhHhhHhHhHhHhHhHhHhHhHhHhHhHhHhHhHhHhHhhhhhhHHhhHHHhHHHHhHHHhHHhHHhhHHhhhhhh!

If there's a glaring problem you want me to know about or you otherwise feel strongly inclined, feel free to bug me at [email protected] or yell at me on Twitter @KyleMorgenstein.

Language Mechanics

The language is pretty simple and is heavily based on COW. There's 16 (+2) commands, which are all the capitalization permutations of hhhh to HHHH. The start key is AHHH. The AHHH language has a memory head (pointer) which can be moved along a tape of memory. There are also two registers that values can be read/written from. Anything that isn't a command is a comment. See fib_inf.ahhh or hello_world_expanded.ahhh for examples of comments/documentation.

The commands are as follows:

Code Command Function
0 hhhh Searching in reverse, skip the first preceding command, and then jump back to matching HHHH command and begin execution from that HHHH command (end loop).
1 hhhH Move the pointer right one cell.
2 hhHh Move the pointer left one cell.
3 hhHH Print the current memory cell as an integer.
4 hHhh If Register 1 is empty, copy the current memory cell to the register. Otherwise, write the Register 1 value to the current memory cell.
5 hHhH If Register 2 is empty, copy the current memory cell to the register. Otherwise, write the Register 2 value to the current memory cell.
6 hHHh Add the current memory cell to the value of Register 1 and store the sum in Register 1. The memory cell is unchanged.
7 hHHH Add the current memory cell to the value of Register 2 and store the sum in Register 2. The memory cell is unchanged.
8 Hhhh If the current memory cell is nonzero, print the cell as an ASCII character. Otherwise, read in an ASCII character from the console.
9 HhhH Increment the current memory cell by one.
10 HhHh Decrement the current memory cell by one.
11 HhHH Read in an integer from the console and store it in the current memory cell (overwrites current cell).
12 HHhh Set the current memory cell to zero.
13 HHhH Double the value of the current memory cell and store it in the current memory cell.
14 HHHh Square the value of the current memory cell and store it in the current memory cell.
15 HHHH If the current memory cell is nonzero, continue to the next command. Otherwise, skip one command, and then skip ahead to the next matching hhhh command (begin loop).
16 AHHH Start program.
17 hhh! Print new line (useful after printing ASCII characters, which otherwise don't print a new line).

As you can see, this language sucks. You won't enjoy it. I think it's pretty funny, which is an accomplishment given the number of brain cells I've killed trying to get this to work. Hopefully you think it's at least passively amusing too. If not, idk, go scream about it or something.

ahhh's People

Contributors

kylem73 avatar peteyreplies avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

ahhh's Issues

Potential Loop Bug

When two HHHH commands are adjacent, because the first one skips the second, an error occurs since the interpreter believes that the loop brackets are unmatched. For example,

AHHH
HHHH
HHHH
hhhh
hhhh

throws an error. Is skipping the first command after each bracket intentional? It seems to do nothing except introduce problems when the following command is either HHHH or hhhh. I think it would make more sense to remove that functionality.

[Need help] Trying to implement fibonAHHHchi !!!

Hi, I'm trying to learn AHHH as my new programming language to implement linux from scratch. And I've implemented fibonacci but got some runtime error. Need help to understand what I'm doing wrong.

AHHH
HhhHhhhHHhhHhhHhhhHHhHhhhhhHhHHhhHhHhHhhhhHhhHhHhhHHhHhhhhhHhHHh
hHhHhHhHhhHhHHhHhhHHhHhhhhhHhHHhhHhHhHhhhhHhhHhHhhHHhHhhhhhHhHHh
hHhHhHhhhhHhhHhHhhHHhHhhhhhHhHHhhHhHhHhhhhHhhHhHhhHHhHhhhhhHhHHh
hHhHhHhhhhHHhHhHhhHHhHhhhhhHhHHhhHHHhHhhhhHhhHhHhhHHhHhhhhhH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hHhHhhHHhHhhhhhHhHHh
hHhHhHhhhhHhhHhHhhHHhHhhhhhHhHHhhHhHhHhhhhHhhHhHhhHHhHhhhhhHhHHh
hHhHhHhhhhHhhHhHhhHHhHhhhhhHhHHhhHhHhHhhhhHhhHhHhhHHhHhhhhhHhHHh
hHhHhHhhhhHhhHhHhhHHhHhhhhhHhHHhhHhHhHhhhhHhhHhHhhHHhHhhhhhHhHHh
hHhHhHhhhhHhhHhH

Me reading the source code!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.