Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411516 Posts in 69380 Topics- by 58436 Members - Latest Member: GlitchyPSI

May 01, 2024, 10:31:01 AM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)So I suddenly feel like making an esoteric language [M-Code]
Pages: [1] 2
Print
Author Topic: So I suddenly feel like making an esoteric language [M-Code]  (Read 3532 times)
Pineapple
Level 10
*****

~♪


View Profile WWW
« on: July 17, 2010, 08:29:39 PM »

An esoteric program language is one that's supposed to be impractical and stupid, but still fun and usually an absurd challenge to use. I've made several in the past but didn't think they were unique enough to make public. I'm in the mood again, and making them is extremely fast, so I need suggestions for something interesting.

Esoteric languages wiki

EDIT:

http://esoteric.voxelperfect.net/wiki/M-code

Download
« Last Edit: July 19, 2010, 04:18:15 AM by _Madk » Logged
B_ill
Level 0
***


View Profile WWW
« Reply #1 on: July 17, 2010, 10:11:05 PM »

An esoteric program language is one that's supposed to be impractical and stupid, but still fun and usually an absurd challenge to use. I've made several in the past but didn't think they were unique enough to make public. I'm in the mood again, and making them is extremely fast, so I need suggestions for something interesting.

Esoteric languages wiki
Shocked Shocked Shocked
Logged

Game Programmer and Designer
Latest Release: Chemical Cubes for Android and Kindle Fire (iOS coming soon)
Laremere
Level 5
*****



View Profile
« Reply #2 on: July 17, 2010, 10:20:36 PM »

TigScript

Use game references to do commands.

Out of curiosity, what are you using/ what method are you using that makes them so easy to make?
Logged

If a tree falls in the forest and no one is around to hear it, is sound_tree_fall.play() called?

"Everything that is really great and inspiring is created by the individual who can labor in freedom."
-Albert Einstein
Skofo
Level 10
*****



View Profile
« Reply #3 on: July 17, 2010, 11:51:15 PM »

Looks like there are a ton of them already. Why not make a joke game dev IDE? An IDE that makes crackheaded games no matter what you try to do.
Logged

If you wish to make a video game from scratch, you must first invent the universe.
oahda
Level 10
*****



View Profile
« Reply #4 on: July 18, 2010, 12:45:08 AM »

An esoteric program language is one that's supposed to be impractical and stupid, but still fun and usually an absurd challenge to use. I've made several in the past but didn't think they were unique enough to make public. I'm in the mood again, and making them is extremely fast, so I need suggestions for something interesting.

Esoteric languages wiki
Shocked Shocked Shocked


What? I've gotten the most important stuff for a serious programming language done in a few days from scratch. Designing is not the hard part. Writing the compiler is.
Logged

Skofo
Level 10
*****



View Profile
« Reply #5 on: July 18, 2010, 01:18:44 AM »

Oh Skomakar'n, you're so dreeeamy. Kiss *swoons*
Logged

If you wish to make a video game from scratch, you must first invent the universe.
increpare
Guest
« Reply #6 on: July 18, 2010, 01:45:57 AM »

A programming language that can only be used to make games -
Logged
Pineapple
Level 10
*****

~♪


View Profile WWW
« Reply #7 on: July 18, 2010, 05:18:29 AM »

I don't really want to do a joke language  Roll Eyes
TigScript

Use game references to do commands.

Out of curiosity, what are you using/ what method are you using that makes them so easy to make?
The fact that I've literally made somewhere between 10 and 20 complete or almost complete parsers means I've got a library of commands I've written and refined over heavy use to make it very fast and painless. But parsing something with single-character commands like BrainF-ck is extraordinarily easy in the first place.
Logged
oahda
Level 10
*****



View Profile
« Reply #8 on: July 18, 2010, 05:26:29 AM »

Oh Skomakar'n, you're so dreeeamy. Kiss *swoons*
You are delicious.
Logged

ChevyRay
Guest
« Reply #9 on: July 18, 2010, 05:39:22 AM »

A programming language that can only be used to make games -

Hahaha love this.
Logged
Pineapple
Level 10
*****

~♪


View Profile WWW
« Reply #10 on: July 18, 2010, 06:17:27 AM »

So I'm settled, I guess. It'll have access to its own source (which will be placed in its memory bank and execution starts at 0)

Here's what I expect the code to look like.
Code:
#[48] 	//attribute 48 bytes to program memory//


$[32] //jump to position 32 in memory//
Hello,[32]world! //Whitespace isn't recognized by the parser. [32] is the ASCII code for a space.//


$[2]

[44]
>[2] //push a constant 44 into the first accumulator//

}[32] //push the memory at address 32 into the second accumulator//
^ //print the character in the second accumulator to the console//
+[4] //increment that previous 32 by 1//
}[4] //push the value into the second accumulator//

S[5] //jump to 5 only if the accumulator A is greater than the accumulator B//

@ //end the program//

That would output "Hello, world!" to the console.

Except it does need some tweaking.



EDIT: A more refined command library:
Code:
Push, pop, output, input for the A, B, and C registers
> < ^ :
} { ` .
) ( ' ,

Output a newline character
;

Copy a byte in memory from one place to another
#

Increment, decrement a byte in memory
i d

Jump unconditionally
j

Jump if A < B
!

Jump if A > B
?

Swap A and B registers
x

Swap B and C registers
y

Swap C and A registers
z

Set a register to 0
a b c

Perform an operation on A and B and place the result in C
Divide: /
Multiply: *
Add: +
Subtract: -
Modulo: %
Raise to power: v
Compare equal: =

Kill program
_

Comment
// (...) //

and what a hello world program would look like now (uncommented)

Code:
>[48]
}[32]^+[5]}[5]?[2]_
$32
Hello,[32]world!
$48
[44]



EDIT: Further refined, likely final:

Code:
Push, pop for the A, B, C registers
> <
} {
) (

Handle the string in memory by printing it, getting it from input, and swapping it with a second memory string
; : ~

Clear the string in memory
s

Print a newline
n

Read characters from the memory string and put them in the A, B, C registers
^ ` '

Write characters to the end of the memory string from the A, B, C registers
: . ,

Copy a byte in memory from one place to another
#

Increment, decrement a byte in memory
i d

Jump unconditionally
j

Jump if A < B
!

Jump if A > B
?

Swap A and B registers
x

Swap B and C registers
y

Swap C and A registers
z

Set a register to 0
a b c

Perform a logical NOT operation on registers A, B, C
A B C

Copy the value in the A register into both B and C
~

Perform an operation on A and B and place the result in C
Divide: /
Multiply: *
Add: +
Subtract: -
Modulo: %
Raise to power: v
Compare equal: =

Kill program
_

Comment
// (...) //
« Last Edit: July 18, 2010, 07:18:22 AM by _Madk » Logged
Pineapple
Level 10
*****

~♪


View Profile WWW
« Reply #11 on: July 18, 2010, 08:04:47 AM »

Just need to make sure I haven't got any bugs going on, then I'll put it up for download.

What should I call it? I've gt not idea what to name it. Preferably something with "TIG" somehow in its title  Beer!

Final command set:
Code:
Push, pop for the A, B, C registers
> <
} {
) (

Handle the string in memory by printing it, getting it from input, and swapping it with a second memory string
; \ ~

Clear the string in memory
s

Read characters from the memory string and put them in the A, B, C registers
^ ` '

Write characters to the end of the memory string from the A, B, C registers
: . ,

Output the numerical value onto the end of the memory string
1 2 3

Copy a byte in memory from one place to another
#

Increment, decrement a byte in memory
i d

increment, decrement the value in the A, B, C registers
h g
u t
e d

Jump unconditionally
j

Jump if A > B
?

Jump if A < B
!

Jump if A = B
=

Swap A and B registers
x

Swap B and C registers
y

Swap C and A registers
z

Set a register to 0
a b c

Perform a logical NOT operation on registers A, B, C
A B C

Copy the value in the A register into both B and C
\

Perform an operation on A and B and place the result in C
Add: +
Subtract: -
Divide: /
Multiply: *
Modulo: %
Raise to power: v
Bit shift left: l
Bit shift right:r

Kill program
_

Comment
// (...) //

EDIT: newly added some logical operators and more bitshifting.



EDIT: Hurrah! A functional Hello World program!

Code:
>[64]j[8]
$8
}[32].i[9]}[9]?[8]
;n_
$32
Hello,[32]world!
$64
[45]


EDIT: But now the parser is screwing up on my Fibonacci number calculation. :/

EDIT: Fibonacci sequence GO!
Code:
>[64]1;s>[65]1;sj[16]
$16
d[66]>[66]b=[96]
>[64]}[65]+3;s
([68]#[65][64]#[68][65]
j[16]
$64
[0][1]
[15]
$96
_
« Last Edit: July 18, 2010, 09:15:09 AM by _Madk » Logged
Pineapple
Level 10
*****

~♪


View Profile WWW
« Reply #12 on: July 18, 2010, 09:43:24 AM »

Two fully functional programs. Every character is 1 byte, numbers enclosed in brackets are single bytes. I think I'll also make a second parser using shorts for numbers as opposed to bytes because a mere 256 bytes of program memory isn't terribly much and may keep it from being turing-complete.

And I need a name!  Undecided

Hello, world!
Code:
// Program execution starts at 0. //

>[64] // Store 45 in register A from memory address 64 to frequently be used as a constant. //
j[8] // Jump to memory address 8 //


$8 // This tells the parser that the following code is intended to start at memory address 8. //
}[32] // Push "H" into register B from address 32. //
. // Add "H" from B to the end of the memory string. //
i[9] // Increment the 32 in }[32] by one, so next loop it'll push "e", then "l", (...) //
}[9] // Push that same number into B to get ready for a comparison. //
?[8] // Jump back to $8 to create a loop if the value in register A is > B to know if we've reached the end of "Hello, world!". //

; // After the above loops has finished, ; prints the accumulated string to the console. //
_ // Terminate program execution. //

$32 // Set the memory address to 32. //
// Whitespace is not recognized by the parser, [32] is the ASCII code for a space. //
Hello,[32]world!

$64 // Set the address to 64. //
[45] // This is for indicating where the "!" in "Hello, world!" is located. //

Fibonacci sequence
Code:
// Program execution starts at 0. //

>[64] 1;s // Store 0 in register A and print it to the console. //
>[65] 1;s // Store 1 in A and print it. //
j[16] // Jump to memory address 16. //

$16 // Set address to 16. This is our main loop start. //

d[66] // Decrement the value at memory address 66 (15) by one. //
>[66] // Push that value into register A. //
b // Set register B to equal 0. //
=[96] // If A = B (A = 0) jump to memory address 96, where a program termination command is located. //

>[64] // Push the first value into A. //
}[65] // Push the second into B. //
+ // Add the first and second values (A+B) and put the result in register C. //
3;s // Print the resulting sum to the console. //
([68] // Pop the result into memory address 68. //
#[65][64] // Shift the second number into where the first was. //
#[68][65] // Shift the new resulting number into where the second was. //

j[16] // Jump back to the loop's start at address 16. //

$64 // Set address to 64, these memory addresses are used as variables in calculation. //
[0][1] // First value of Fibonacci sequence starts as 0, second starts as 1. //
[15] // Number of iterations (n-1) of the sequence to go through. //

$96 // Set address to 96. //
_ // Program termination command. //

Just a couple quick things and I'll make a download.
Logged
Pineapple
Level 10
*****

~♪


View Profile WWW
« Reply #13 on: July 18, 2010, 10:57:29 AM »

M-Code shall be its name.

There are 3 variations - 8 bit, 16 bit, and 32 bit. Read the readme for the differences, read reference.txt for the complete command set. Post any questions here if it's hard to understand and I'll do my best to clarify. Please note that it's not verified to be 100% bug free.

Download
Logged
Linus
Level 0
***


View Profile
« Reply #14 on: July 18, 2010, 09:49:22 PM »

This reminds me of a language me and a friend built once, aptly named Spacek.

I say aptly named, because the characters s,p,a,c,e,k,S,P,A,C,E,K represented the possible commands in the language, including characters to switch between command sets, and characters to output the whole program source. Also a segfaulter. All esoteric languages need a segfaulter.
Logged
Pineapple
Level 10
*****

~♪


View Profile WWW
« Reply #15 on: July 19, 2010, 04:17:43 AM »

I fixed a major bug regarding parsing source with comments. Redownload if you please.
Logged
Pineapple
Level 10
*****

~♪


View Profile WWW
« Reply #16 on: July 19, 2010, 07:36:41 AM »

I added labels. Some things are much easier now. Also a handful of bugfixes.

I need to get work on my AGBIC entry  Tired
Logged
Melly
Level 10
*****


This is how being from "da hood" is like, right?


View Profile
« Reply #17 on: July 19, 2010, 11:37:38 AM »

Looks like there are a ton of them already. Why not make a joke game dev IDE? An IDE that makes crackheaded games no matter what you try to do.

Most people here would think of a Cactus IDE.

I'd personally make a Sweet Bro and Hella Jeff game development tool. Everything you try to do with it turns into an unplayable, barely comprehensible mess (with the key part being that all art and sound assets are compressed and distorted until they're barely recognizeable). By design, there is no way to stop the games from crashing at random intervals, possibly crashing the rest of the computer with them.

It would be glorious.
Logged

Feel free to disregard the above.
Games: Minus / Action Escape Kitty
Grif
Guest
« Reply #18 on: July 19, 2010, 11:50:25 AM »

I'd personally make a Sweet Bro and Hella Jeff game development tool. Everything you try to do with it turns into an unplayable, barely comprehensible mess (with the key part being that all art and sound assets are compressed and distorted until they're barely recognizeable). By design, there is no way to stop the games from crashing at random intervals, possibly crashing the rest of the computer with them.

It would be glorious.

But the Sweet Bro and Hella Jeff games have already been made in exquisite detail.
Logged
Pineapple
Level 10
*****

~♪


View Profile WWW
« Reply #19 on: July 19, 2010, 11:52:55 AM »

"Hello, world!"

Code:
">+++++++++[<++++++++>-]<.>+++++++[<++++>-]<+.+++++++..+++.>>>++++++++[<++++>-]<.>>>++++++++++[<+++++++++>-]<---.<<<<.+++.------.--------.>>+.#
"Please wait, this may take a while :P
~;s~j[16]><+-.,[0]#[223]^[1]}[6]N[26]i[15]j[172]}[7]N"d[15]j[172]}[8]
N-#[15]*i[0]j[172]}[9]N8#[15]5d[0]j[172]}[10]NH#[15]@)[0]~s,;~j[172]}[11]
NX~\'[1]~#[15]U([0]j[172]}[12]N[132]#[15]`}[0]4[0]N[172]4[1]<[194]4[0]}[194]
=[172]i[17]#[17]u^[0]}[12]N[0]4[0]}[194]d[17]=[172]#[17][152]^[0]}[12]N[159]
d[194]}[13]N[140]i[194]j[140]}[14]N[172]_i[17]>[17]5[255]N[183]#
[192][17]5[221]N[16]#[193][17]j[16][222][254]


BrainF*ck interpreter GET.
Logged
Pages: [1] 2
Print
Jump to:  

Theme orange-lt created by panic