From Esolang
Jump to navigation Jump to search
Note: This article contains special characters.

Aheui (아희 in Korean language) is the first esoteric programming language ever to be designed for Hangul, the Korean alphabet, designed by User:Puzzlet Chung.

Many of the Aheui's concept is derived from Befunge-93, except the fact that it has no instruction for self-modifying, and that it has 26 stacks and one queue.


A program is a grid of characters(it doesn't need to be a rectangle). If the cursor arrives at a boundary of the grid, it wraps around to the other side of the grid but maintains the same momentum. Complete Hangul characters(they are commands) are made of three parts:

  1. initial consonant
  2. vowel
  3. final consonant

The initial consonants are:


The vowels are:


And the final consonants are:

(no consonant),ㄱ,ㄲ,ㄳ,ㄴ,ㄵ,ㄶ,ㄷ,ㄹ,ㄺ,ㄻ,ㄼ,ㄽ,ㄾ,

The examples of complete Hangul characters: 한, 가, 응. Incomplete Hangul(ㄱ, ㅇ, ㅑ, ㅟ) and non-Hangul characters are treated as comments. The commands are executed as follows:

  1. Process the consonants(they specify the actual instruction). Update the momentum if required by the consonants.
  2. Set the momentum of the cursor based on the current momentum and the vowel(it changes the momentum).
  3. Move the cursor based on the current momentum.

Instruction pointer starts at the top left corner([0;0]) and is moving down(it has a [1;0] momentum).



In Aheui, the following vowels have no use (although they can still be included in valid programs):


Other vowels change momentum as follows:

Vowel Momentum
current momentum reflected vertically.
current momentum reflected horizontally.
current momentum reflected both vertically and horizontally.


When reading a character, the initial consonant specifies the action to be performed. If the action takes in some parameter, the final consonant (or lack thereof) is used as the value for the parameter. If there is less values than needed in the current storage, instructions only reverse the momentum. The functionality of the consonants can be broken down into the following groups:

The "ㅇ" group:
Consonant Description
Terminate the program.

(If the current storage is non-empty, the program pops from the storage and returns the result. If the current storage is empty, the program returns 0.)

The final consonant is not used.

The "ㄷ" group (arithmetic operations):
Consonant Description
Pops two values from the current storage and pushes their sum.
Pops two values from the current storage and pushes their product
Pops two values from the current storage,

performs integer division and pushes the result.

Pops two values from the current storage,

subtracts the 1st value from the 2nd and pushes the result.

Pops two values from the current storage,

performs modulo(second%first) and pushes the result.

Pops two values from the current storage,

performs integer division and pushes the result.

All of the "ㄷ" group ingnores the final consonant.

The "ㅁ" group(storage manipulation):
Consonant Description
Pops the value from the current storage.

If the final consonant is "ㅇ": Print it as an integer. If it is "ㅎ": Print as the unicode(UTF-8) character. Otherwise do nothing with the value.

If the final consonant is "ㅇ":
 Pushes an integer from the input to the current storage.

If it is "ㅎ": Pushes the value of the unicode(UTF-8) character from the input to the current storage. Otherwise, pushes the number of strokes required to draw the consonant to the current storage:

ㄱ:2 ㄴ:2 ㄷ:3 ㄹ:5 ㅁ:4 ㅂ:4 ㅅ:2 ㅈ:3 ㅊ:4 ㅋ:3 ㅌ:4 ㅍ:4 ㄲ:4 ㄳ:4 ㄵ:5 ㄶ:5 ㄺ:7 ㄻ:9 ㄼ:9 ㄽ:9 ㄾ:9 ㄿ:9 ㅀ:8 ㅄ:6 ㅆ:4 (no consonant):0

The "ㅅ" group:
Consonant Description
Current storage is changed by the final consonants.
The current storage is popped and the returned value is pushed into the storage mapped to by the final consonant.
Pops 2 values from the current storage. If the latter value is greater than or equal to the former value(first≥second), pushes 1 to the current storage, pushes 0 otherwise.
Pops a value from current storage. If the value is zero, reverses the current momentum. Else, do nothing.

The final consonants are mapped to the storages as follows:

The stacks: none, ㄱ, ㄴ, ㄷ, ㄹ, ㅁ, ㅂ, ㅇ, ㅅ, ㅈ, ㅊ, ㅋ, ㅌ, ㅍ, ㅎ, ㄲ, ㄳ, ㄵ, ㄶ, 
ㄺ, ㄻ, ㄼ, ㄽ, ㄾ, ㄿ, ㅀ, ㅄ, or ㅆ.
The queue: ㅇ.
The extension protocol: ㅎ.

Computational class

Unlike Befunge-93, Aheui does not specify limit of codespace; however, Aheui does not use codespace as a storage. Aheui has additional stacks instead. Since a pair of unbounded stacks can be used to simulate the unbounded tape of a Turing machine, it is likely that Aheui is Turing-complete. Partial proof.


Hello world

This code prints "Hello, world!":




Times table generator

Not available

Project Euler

Problem 1

This code is for Project Euler's Problem 1. It may still need reduction.


Problem 2

This program may need reduction.


Problem 5


Problem 6


Special characters

This article contains special characters that fall in the Hangul Syllable area of the Unicode charset. You need an appropriate font for the browser to display it correctly. Because Aheui is a two-dimensional language, using a monospacial Hangul font is highly recommended. (e.g. UnDotum)

External resources