Skip to content

JacksonGuy/Arthas

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Arthas

A slightly more advanced Brainfuck-esque language.

Why?

Because I got bored one night.
Also, because Brainfuck is a cool language, except that it sucks to use. So, I decided to make it more practical.

Features

Comments

Unlike Brainfuck, and sadly the only feature which makes this compiler incapable of fully compiling Brainfuck files, is that comments must follow a //.
Example:

+>++>+++ // Puts 1,2,3 into memory



Set Value

Probably the most useful feature, now you can insert numbers directly into memory using the = command.
Example:

=65 // Sets cell 0 to 65



Set Pointer Position

The Second most useful feature, rather than moving between cells one-by-one, you can now move to any cell immediately.
Example:

%10=66 // Sets cell 10 to 66



Goto cell value

Moves the cell pointer to the value of the current cell.
Example:

%5=67 // Sets cell 5 to 67
>=5 // Sets cell 6 to 5
&. // Sets pointer to cell 5, then outputs its value (67)



Copy Value

Copies the value of the current cell into the specified cell Example:

%0=57 // Sets cell 0 to 57
*1    // Copies 57 into cell 1



Character values

Good news! Now you don't need to remember every value of an ASCII table. We can now directly enter an ASCII character into a cell.
Example:

='H'>='i'>='!' // Enters "Hi!" into three consecutive cells



Strings

Additionally, now we can just input entire strings into memory with ease.
Example:

S"Hello, World!\n"

We begin a string with the S character, and enclose the string with quotes.
Starting at the current cell, we first store the size of the string. Then, in the next cell, we store the the starting position of the string.
In the above example, the program memory would look like this:

[15][2][72][101][108][108] (...)

The number 15 is the length of the string, and the number 2 is the cell of the first letter of the string.

Functions

Our most advanced feature, we can now declare functions!
We declare functions as such:

D add_one +;

You start with the character D, then follow it with the name of the function, then the functions code, ending with a semicolon.
I'll warn that the compiler is very picky about function declarations.
  1. The 'D' must be followed by a space.
  2. The function name cannot have a space in the name. Besides that, go wild
  3. The code portion must end with a semicolon.

To call functions:
F(add_one)

We use the `F` character, with the function name surrounded by parenthesis. After the function call, the program will return to the position right after the last parenthesis (this is why you need the semicolon)(So I guess you don't technically need the semicolon).

Output modes

You now have the option of interpreting values in memory as regular integer numbers rather than ASCII characters.
To switch between ASCII and INT output modes, use the ! command.
Example:

=65 . // Outputs A
! .   // Outputs 65



Copy memory location

To copy the current memory location to a specified location:

%15=13 // Assigns 13 to cell 15
@0     // Copys current location (15) to cell 0

About

A (slightly) modified Brainfuck compiler

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages