kammt / memeassembly Goto Github PK
View Code? Open in Web Editor NEWA Meme-based programming language
Home Page: https://memeassembly.wtf/
License: GNU General Public License v3.0
A Meme-based programming language
Home Page: https://memeassembly.wtf/
License: GNU General Public License v3.0
0649c3f prevents the very important possibility of combining memory operands with immediate operands. Consider choosing a random operand size to work around assembler encoding ambiguity. (Pls fix ASAP, my students need this.)
See #57 (comment) for reference
Quote:
The main idea is to add an ability to jump with condition so you can achieve something like this:
C
if(a > 5 && a < 20) {
// some code
}
// continue
ASM
cmp eax, 5
jle .LYeet0
cmp eax, 19
jg .LYeet0
# some code
.LYeet0:
# continue
While MemeASM already supports functions, one cannot call a function, as there is currently no command for that.
Command name ideas:
whomst have summoned the almighty one [function name]
the secret ingredient is [function name]
Describe the bug
Negative numbers are accepted in comparisons, yet as
will reject the generated labels due to a -
being in them
Possible workaround: Convert parameter to Hex before translation
To Reproduce
I like to have fun, fun, fun, fun, fun, fun, fun, fun, fun, fun main
who would win? rax or -1
rax wins
-1 wins
right back at ya, buckaroo
results in the following error messages:
{standard input}: Assembler messages:
{standard input}:65: Error: junk `Wins_0' after expression
{standard input}:67: Error: unknown pseudo-op: `.l'
gcc exited unexpectedly with exit code 256. If you did not expect this to happen, please report this issue at https://github.com/kammt/MemeAssembly/issues so that it can be fixed
Line 65 being .L-1Wins_0:
Reported by @0li5Drr
Describe the bug
Some return statements do not appear to be interpreted as return statements when having multiple functions in a file.
To Reproduce
I like to have fun, fun, fun, fun, fun, fun, fun, fun, fun, fun a
what can I say except a
b: whomst has summoned the almighty one
I see this as an absolute win
I like to have fun, fun, fun, fun, fun, fun, fun, fun, fun, fun b
what can I say except b
c: whomst has summoned the almighty one
right back at ya, buckaroo
I like to have fun, fun, fun, fun, fun, fun, fun, fun, fun, fun c
what can I say except c
no, I don't think I will
I like to have fun, fun, fun, fun, fun, fun, fun, fun, fun, fun main
a: whomst has summoned the almighty one
I see this as an absolute win
Used compiler flags[e.g. -O-1 -c]: None, memeasm -o './main' 'test.memeasm' && ./main
Debug Output
Opening file "test.memeasm" successful, parsing file... The number of lines are 14 Struct array was created successfully Parsing line: I like to have fun, fun, fun, fun, fun, fun, fun, fun, fun, fun a comparing with I comparing with like comparing with to comparing with have comparing with fun, comparing with fun, comparing with fun, comparing with fun, comparing with fun, comparing with fun, comparing with fun, comparing with fun, comparing with fun, comparing with fun comparing with {p} a contains a parameter Parsing line: what can I say except a comparing with I Matching failed, attempting to match next command comparing with right Matching failed, attempting to match next command comparing with no, Matching failed, attempting to match next command comparing with I Matching failed, attempting to match next command comparing with {p}: Matching failed - chars before or after {p} mismatching, attempting to match next command comparing with stonks Matching failed, attempting to match next command comparing with not Matching failed, attempting to match next command comparing with bitconneeeeeeect Matching failed, attempting to match next command comparing with {p} what contains a parameter comparing with \s Matching failed, attempting to match next command comparing with sneak Matching failed, attempting to match next command comparing with {p} what contains a parameter comparing with is Matching failed, attempting to match next command comparing with upvote Matching failed, attempting to match next command comparing with downvote Matching failed, attempting to match next command comparing with parry Matching failed, attempting to match next command comparing with {p} what contains a parameter comparing with units Matching failed, attempting to match next command comparing with upgrades, Matching failed, attempting to match next command comparing with they Matching failed, attempting to match next command comparing with {p} what contains a parameter comparing with is Matching failed, attempting to match next command comparing with look Matching failed, attempting to match next command comparing with {p} what contains a parameter comparing with UNLIMITED Matching failed, attempting to match next command comparing with upgrade Matching failed, attempting to match next command comparing with fuck Matching failed, attempting to match next command comparing with banana Matching failed, attempting to match next command comparing with where Matching failed, attempting to match next command comparing with monke Matching failed, attempting to match next command comparing with return Matching failed, attempting to match next command comparing with who Matching failed, attempting to match next command comparing with {p} what contains a parameter comparing with wins Matching failed, attempting to match next command comparing with corporate Matching failed, attempting to match next command comparing with they're Matching failed, attempting to match next command comparing with what comparing with can comparing with I comparing with say comparing with except comparing with {p} a contains a parameter Parsing line: b: whomst has summoned the almighty one comparing with I Matching failed, attempting to match next command comparing with right Matching failed, attempting to match next command comparing with no, Matching failed, attempting to match next command comparing with I Matching failed, attempting to match next command comparing with {p}: b: contains a parameter comparing with whomst comparing with has comparing with summoned comparing with the comparing with almighty comparing with one Parsing line: I see this as an absolute win comparing with I comparing with like Matching failed, attempting to match next command comparing with right Matching failed, attempting to match next command comparing with no, Matching failed, attempting to match next command comparing with I comparing with see comparing with this comparing with as comparing with an comparing with absolute comparing with win Parsing line: I like to have fun, fun, fun, fun, fun, fun, fun, fun, fun, fun b comparing with I comparing with like comparing with to comparing with have comparing with fun, comparing with fun, comparing with fun, comparing with fun, comparing with fun, comparing with fun, comparing with fun, comparing with fun, comparing with fun, comparing with fun comparing with {p} b contains a parameter Parsing line: what can I say except b comparing with I Matching failed, attempting to match next command comparing with right Matching failed, attempting to match next command comparing with no, Matching failed, attempting to match next command comparing with I Matching failed, attempting to match next command comparing with {p}: Matching failed - chars before or after {p} mismatching, attempting to match next command comparing with stonks Matching failed, attempting to match next command comparing with not Matching failed, attempting to match next command comparing with bitconneeeeeeect Matching failed, attempting to match next command comparing with {p} what contains a parameter comparing with \s Matching failed, attempting to match next command comparing with sneak Matching failed, attempting to match next command comparing with {p} what contains a parameter comparing with is Matching failed, attempting to match next command comparing with upvote Matching failed, attempting to match next command comparing with downvote Matching failed, attempting to match next command comparing with parry Matching failed, attempting to match next command comparing with {p} what contains a parameter comparing with units Matching failed, attempting to match next command comparing with upgrades, Matching failed, attempting to match next command comparing with they Matching failed, attempting to match next command comparing with {p} what contains a parameter comparing with is Matching failed, attempting to match next command comparing with look Matching failed, attempting to match next command comparing with {p} what contains a parameter comparing with UNLIMITED Matching failed, attempting to match next command comparing with upgrade Matching failed, attempting to match next command comparing with fuck Matching failed, attempting to match next command comparing with banana Matching failed, attempting to match next command comparing with where Matching failed, attempting to match next command comparing with monke Matching failed, attempting to match next command comparing with return Matching failed, attempting to match next command comparing with who Matching failed, attempting to match next command comparing with {p} what contains a parameter comparing with wins Matching failed, attempting to match next command comparing with corporate Matching failed, attempting to match next command comparing with they're Matching failed, attempting to match next command comparing with what comparing with can comparing with I comparing with say comparing with except comparing with {p} b contains a parameter Parsing line: c: whomst has summoned the almighty one comparing with I Matching failed, attempting to match next command comparing with right Matching failed, attempting to match next command comparing with no, Matching failed, attempting to match next command comparing with I Matching failed, attempting to match next command comparing with {p}: c: contains a parameter comparing with whomst comparing with has comparing with summoned comparing with the comparing with almighty comparing with one Parsing line: right back at ya, buckaroo comparing with I Matching failed, attempting to match next command comparing with right comparing with back comparing with at comparing with ya, comparing with buckaroo Parsing line: I like to have fun, fun, fun, fun, fun, fun, fun, fun, fun, fun c comparing with I comparing with like comparing with to comparing with have comparing with fun, comparing with fun, comparing with fun, comparing with fun, comparing with fun, comparing with fun, comparing with fun, comparing with fun, comparing with fun, comparing with fun comparing with {p} c contains a parameter Parsing line: what can I say except c comparing with I Matching failed, attempting to match next command comparing with right Matching failed, attempting to match next command comparing with no, Matching failed, attempting to match next command comparing with I Matching failed, attempting to match next command comparing with {p}: Matching failed - chars before or after {p} mismatching, attempting to match next command comparing with stonks Matching failed, attempting to match next command comparing with not Matching failed, attempting to match next command comparing with bitconneeeeeeect Matching failed, attempting to match next command comparing with {p} what contains a parameter comparing with \s Matching failed, attempting to match next command comparing with sneak Matching failed, attempting to match next command comparing with {p} what contains a parameter comparing with is Matching failed, attempting to match next command comparing with upvote Matching failed, attempting to match next command comparing with downvote Matching failed, attempting to match next command comparing with parry Matching failed, attempting to match next command comparing with {p} what contains a parameter comparing with units Matching failed, attempting to match next command comparing with upgrades, Matching failed, attempting to match next command comparing with they Matching failed, attempting to match next command comparing with {p} what contains a parameter comparing with is Matching failed, attempting to match next command comparing with look Matching failed, attempting to match next command comparing with {p} what contains a parameter comparing with UNLIMITED Matching failed, attempting to match next command comparing with upgrade Matching failed, attempting to match next command comparing with fuck Matching failed, attempting to match next command comparing with banana Matching failed, attempting to match next command comparing with where Matching failed, attempting to match next command comparing with monke Matching failed, attempting to match next command comparing with return Matching failed, attempting to match next command comparing with who Matching failed, attempting to match next command comparing with {p} what contains a parameter comparing with wins Matching failed, attempting to match next command comparing with corporate Matching failed, attempting to match next command comparing with they're Matching failed, attempting to match next command comparing with what comparing with can comparing with I comparing with say comparing with except comparing with {p} c contains a parameter Parsing line: no, I don't think I will comparing with I Matching failed, attempting to match next command comparing with right Matching failed, attempting to match next command comparing with no, comparing with I comparing with don't comparing with think comparing with I comparing with will Parsing line: I like to have fun, fun, fun, fun, fun, fun, fun, fun, fun, fun main comparing with I comparing with like comparing with to comparing with have comparing with fun, comparing with fun, comparing with fun, comparing with fun, comparing with fun, comparing with fun, comparing with fun, comparing with fun, comparing with fun, comparing with fun comparing with {p} main contains a parameter Parsing line: a: whomst has summoned the almighty one comparing with I Matching failed, attempting to match next command comparing with right Matching failed, attempting to match next command comparing with no, Matching failed, attempting to match next command comparing with I Matching failed, attempting to match next command comparing with {p}: a: contains a parameter comparing with whomst comparing with has comparing with summoned comparing with the comparing with almighty comparing with one Parsing line: I see this as an absolute win comparing with I comparing with like Matching failed, attempting to match next command comparing with right Matching failed, attempting to match next command comparing with no, Matching failed, attempting to match next command comparing with I comparing with see comparing with this comparing with as comparing with an comparing with absolute comparing with win Number of functions: 4 Parsing function: Iteration stopped at index 4 Parsing function: test.memeasm:17: error: expected a return statement, but got a new function definition Iteration stopped at index 4 Parsing function: test.memeasm:24: error: expected a return statement, but got a new function definition Iteration stopped at index 3 Parsing function: Iteration stopped at index 3 File parsing done, closing file... Starting parameter validity check Checking parameter a Parameter is a valid function name Starting parameter validity check Checking parameter a Parameter is not an 8 bit register Parameter is a character, translated to: 'a' Starting parameter validity check Checking parameter b Parameter is a valid function name Starting parameter validity check Starting parameter validity check Checking parameter b Parameter is a valid function name Starting parameter validity check Checking parameter b Parameter is not an 8 bit register Parameter is a character, translated to: 'b' Starting parameter validity check Checking parameter c Parameter is a valid function name Starting parameter validity check Starting parameter validity check Checking parameter c Parameter is a valid function name Starting parameter validity check Checking parameter c Parameter is not an 8 bit register Parameter is a character, translated to: 'c' Starting parameter validity check Starting parameter validity check Checking parameter main Parameter is a valid function name Starting parameter validity check Checking parameter a Parameter is a valid function name Starting parameter validity check Label duplicity check for function in line 1 in file 0 Comparing against parameter b Comparing against parameter c Comparing against parameter main Label duplicity check for function in line 8 in file 0 Comparing against parameter c Comparing against parameter main Label duplicity check for function in line 17 in file 0 Comparing against parameter main Label duplicity check for function in line 24 in file 0 Looking for function of parent command in line 4 in file 0 Looking for function of parent command in line 11 in file 0 Looking for function of parent command in line 26 in file 0 Starting jump label validity check for opcode 20 Starting jump label validity check for opcode 22 Beginning Monke jump label validity check Starting analysis for "who would win?" command Starting analysis for "corporate needs you to find the difference..." command Chose random line for jump marker: 5 Starting analysis of the "Perfectly balanced..." command amount of times perfectly balanced was used: 0 amount of lines to be deleted: 0 Analysis done, freeing memory
System Info (please complete the following information):
sudo make install
)Since stabs is only supported on Linux, MacOS and Windows currently do not support the -g
-Flag
It's a trap
should translate to int3
, raising SIGTRAP
If a debugger is attached, this breaks into the debugger. From there, one can continue normal program execution.
Without debugger, this by default causes the running process to terminate and generates a core dump.
Since v1.4, most error messages are sort of helpful. But is that really what the user wants when coding in MemeASM? I think not.
That's why I propose to add a new compilation mode. Bully mode. It can be activated using -fcompile-mode=bully
(or disabled using -fcompile-mode=noob
) and changes the following:
The result is that provided code will always compile, but will in general not do what the programmer intended it to do
Console Output:
Semantic Error in line 1: An executable cannot be created if no main-function exists
Floating point exception (core dumped)
Describe the bug
r8
as a temporary register, regardless of whether this is the actual destination register or not.To Reproduce
I like to have fun, fun, fun, fun, fun, fun, fun, fun, fun, fun main
r8 is brilliant, but I like 9
look at what 3 needs to mimic a fraction of r8
right back at ya, buckaroo
Describe the bug
As of now, decimal numbers are just plain forwarded as-is. Yet in ASM their sizes are limited. mov
has a limit of 64 Bit, while other instructions only accept values in the range of a 32 Bit signed integer. This is not checked by the compiler.
To Reproduce
One can e.g. write al is brilliant, but I like 999999999999
If so, an error message should be printed
Command Syntax: (e.g. stonks [register]
)
Alright. I've hacked into the mainframe and disabled their algorithms.
Command Description:
Tries to kill init
using SIGKILL.
Which x86_64 Assembly instruction(s) would be used to translate this command?
mov rdi, 1
mov rsi, 9
call kill
What could this command be useful for?
Having fun :).
What Meme is your command based on? (You can also provide a link to e.g. its KnowYourMeme page)
If you like the idea, i'd be happy to implement this in a few months, once I've got less stuff on my plate :).
When I compile the following program, the compiler crashes:
What the hell happened here? This function should print the value in ebx in binary
I like to have fun, fun, fun, fun, fun, fun, fun, fun, fun, fun main
What the hell happened here? Put in the value you want to print in binary
ebx is brilliant, but I like 53
sneak 100 rax
sneak 100 rcx
sneak 100 edx
upvote edx
monke uaaauaaa
who would win? ebx or edx
ebx wins
eax is brilliant, but I like ebx
bitconneeeeeeect eax 1
upvote rcx
stonks rax
they had us in the first half, not gonna lie ebx
return to monke uaaauaaa
edx wins
sneak 100 edi
upvote edi
monke uaaauaaauaaauaaa
who would win? ecx or edi
ecx wins
not stonks rax
sneak 100 eax or draw 25
sneak 100 eax or draw 25
parry 2 you filthy casual eax
what can I say except al
downvote rcx
return to monke uaaauaaauaaauaaa
edi wins
what can I say except \n
I see this as an absolute win
Error message:
$ memeasm -o main itoa.memeasm
free(): invalid pointer
Aborted (core dumped)
Describe the bug
When using the what can I say except T
command, the output sometimes just doesn't show up.
This is because for some reason the writechar
function no longer sets rdi
to 1
/stdout
; so it just uses whatever value was in rdi
before.
It can also be seen when running the example below with strace
:
execve("./main", ["./main"], 0x7fffe5d793a0 /* 28 vars */) = 0 [... irrelevant stuff...] write(5, "T", 1) = -1 EBADF (Bad file descriptor) write(5, "e", 1) = -1 EBADF (Bad file descriptor) write(5, "s", 1) = -1 EBADF (Bad file descriptor) write(5, "t", 1) = -1 EBADF (Bad file descriptor) exit_group(0) = ? +++ exited with 0 +++
To Reproduce
I like to have fun, fun, fun, fun, fun, fun, fun, fun, fun, fun main
rdi is brilliant, but I like 5
what can I say except T
what can I say except e
what can I say except s
what can I say except t
I see this as an absolute win
Used compiler flags[e.g. -O-1 -c]: none, memeasm -o './main' 'min.memeasm' && strace ./main
Debug Output (not really relevant)
Opening file "min.memeasm" successful, parsing file... The number of lines are 7 Struct array was created successfully Parsing line: I like to have fun, fun, fun, fun, fun, fun, fun, fun, fun, fun main comparing with I comparing with like comparing with to comparing with have comparing with fun, comparing with fun, comparing with fun, comparing with fun, comparing with fun, comparing with fun, comparing with fun, comparing with fun, comparing with fun, comparing with fun comparing with {p} main contains a parameter Parsing line: rdi is brilliant, but I like 1 comparing with I Matching failed, attempting to match next command comparing with right Matching failed, attempting to match next command comparing with no, Matching failed, attempting to match next command comparing with I Matching failed, attempting to match next command comparing with {p}: Matching failed - chars before or after {p} mismatching, attempting to match next command comparing with stonks Matching failed, attempting to match next command comparing with not Matching failed, attempting to match next command comparing with bitconneeeeeeect Matching failed, attempting to match next command comparing with {p} rdi contains a parameter comparing with \s Matching failed, attempting to match next command comparing with sneak Matching failed, attempting to match next command comparing with {p} rdi contains a parameter comparing with is comparing with brilliant, comparing with but comparing with I comparing with like comparing with {p} 1 contains a parameter Parsing line: what can I say except T comparing with I Matching failed, attempting to match next command comparing with right Matching failed, attempting to match next command comparing with no, Matching failed, attempting to match next command comparing with I Matching failed, attempting to match next command comparing with {p}: Matching failed - chars before or after {p} mismatching, attempting to match next command comparing with stonks Matching failed, attempting to match next command comparing with not Matching failed, attempting to match next command comparing with bitconneeeeeeect Matching failed, attempting to match next command comparing with {p} what contains a parameter comparing with \s Matching failed, attempting to match next command comparing with sneak Matching failed, attempting to match next command comparing with {p} what contains a parameter comparing with is Matching failed, attempting to match next command comparing with upvote Matching failed, attempting to match next command comparing with downvote Matching failed, attempting to match next command comparing with parry Matching failed, attempting to match next command comparing with {p} what contains a parameter comparing with units Matching failed, attempting to match next command comparing with upgrades, Matching failed, attempting to match next command comparing with they Matching failed, attempting to match next command comparing with {p} what contains a parameter comparing with is Matching failed, attempting to match next command comparing with look Matching failed, attempting to match next command comparing with {p} what contains a parameter comparing with UNLIMITED Matching failed, attempting to match next command comparing with upgrade Matching failed, attempting to match next command comparing with fuck Matching failed, attempting to match next command comparing with banana Matching failed, attempting to match next command comparing with where Matching failed, attempting to match next command comparing with monke Matching failed, attempting to match next command comparing with return Matching failed, attempting to match next command comparing with who Matching failed, attempting to match next command comparing with {p} what contains a parameter comparing with wins Matching failed, attempting to match next command comparing with corporate Matching failed, attempting to match next command comparing with they're Matching failed, attempting to match next command comparing with what comparing with can comparing with I comparing with say comparing with except comparing with {p} T contains a parameter Parsing line: what can I say except e comparing with I Matching failed, attempting to match next command comparing with right Matching failed, attempting to match next command comparing with no, Matching failed, attempting to match next command comparing with I Matching failed, attempting to match next command comparing with {p}: Matching failed - chars before or after {p} mismatching, attempting to match next command comparing with stonks Matching failed, attempting to match next command comparing with not Matching failed, attempting to match next command comparing with bitconneeeeeeect Matching failed, attempting to match next command comparing with {p} what contains a parameter comparing with \s Matching failed, attempting to match next command comparing with sneak Matching failed, attempting to match next command comparing with {p} what contains a parameter comparing with is Matching failed, attempting to match next command comparing with upvote Matching failed, attempting to match next command comparing with downvote Matching failed, attempting to match next command comparing with parry Matching failed, attempting to match next command comparing with {p} what contains a parameter comparing with units Matching failed, attempting to match next command comparing with upgrades, Matching failed, attempting to match next command comparing with they Matching failed, attempting to match next command comparing with {p} what contains a parameter comparing with is Matching failed, attempting to match next command comparing with look Matching failed, attempting to match next command comparing with {p} what contains a parameter comparing with UNLIMITED Matching failed, attempting to match next command comparing with upgrade Matching failed, attempting to match next command comparing with fuck Matching failed, attempting to match next command comparing with banana Matching failed, attempting to match next command comparing with where Matching failed, attempting to match next command comparing with monke Matching failed, attempting to match next command comparing with return Matching failed, attempting to match next command comparing with who Matching failed, attempting to match next command comparing with {p} what contains a parameter comparing with wins Matching failed, attempting to match next command comparing with corporate Matching failed, attempting to match next command comparing with they're Matching failed, attempting to match next command comparing with what comparing with can comparing with I comparing with say comparing with except comparing with {p} e contains a parameter Parsing line: what can I say except s comparing with I Matching failed, attempting to match next command comparing with right Matching failed, attempting to match next command comparing with no, Matching failed, attempting to match next command comparing with I Matching failed, attempting to match next command comparing with {p}: Matching failed - chars before or after {p} mismatching, attempting to match next command comparing with stonks Matching failed, attempting to match next command comparing with not Matching failed, attempting to match next command comparing with bitconneeeeeeect Matching failed, attempting to match next command comparing with {p} what contains a parameter comparing with \s Matching failed, attempting to match next command comparing with sneak Matching failed, attempting to match next command comparing with {p} what contains a parameter comparing with is Matching failed, attempting to match next command comparing with upvote Matching failed, attempting to match next command comparing with downvote Matching failed, attempting to match next command comparing with parry Matching failed, attempting to match next command comparing with {p} what contains a parameter comparing with units Matching failed, attempting to match next command comparing with upgrades, Matching failed, attempting to match next command comparing with they Matching failed, attempting to match next command comparing with {p} what contains a parameter comparing with is Matching failed, attempting to match next command comparing with look Matching failed, attempting to match next command comparing with {p} what contains a parameter comparing with UNLIMITED Matching failed, attempting to match next command comparing with upgrade Matching failed, attempting to match next command comparing with fuck Matching failed, attempting to match next command comparing with banana Matching failed, attempting to match next command comparing with where Matching failed, attempting to match next command comparing with monke Matching failed, attempting to match next command comparing with return Matching failed, attempting to match next command comparing with who Matching failed, attempting to match next command comparing with {p} what contains a parameter comparing with wins Matching failed, attempting to match next command comparing with corporate Matching failed, attempting to match next command comparing with they're Matching failed, attempting to match next command comparing with what comparing with can comparing with I comparing with say comparing with except comparing with {p} s contains a parameter Parsing line: what can I say except t comparing with I Matching failed, attempting to match next command comparing with right Matching failed, attempting to match next command comparing with no, Matching failed, attempting to match next command comparing with I Matching failed, attempting to match next command comparing with {p}: Matching failed - chars before or after {p} mismatching, attempting to match next command comparing with stonks Matching failed, attempting to match next command comparing with not Matching failed, attempting to match next command comparing with bitconneeeeeeect Matching failed, attempting to match next command comparing with {p} what contains a parameter comparing with \s Matching failed, attempting to match next command comparing with sneak Matching failed, attempting to match next command comparing with {p} what contains a parameter comparing with is Matching failed, attempting to match next command comparing with upvote Matching failed, attempting to match next command comparing with downvote Matching failed, attempting to match next command comparing with parry Matching failed, attempting to match next command comparing with {p} what contains a parameter comparing with units Matching failed, attempting to match next command comparing with upgrades, Matching failed, attempting to match next command comparing with they Matching failed, attempting to match next command comparing with {p} what contains a parameter comparing with is Matching failed, attempting to match next command comparing with look Matching failed, attempting to match next command comparing with {p} what contains a parameter comparing with UNLIMITED Matching failed, attempting to match next command comparing with upgrade Matching failed, attempting to match next command comparing with fuck Matching failed, attempting to match next command comparing with banana Matching failed, attempting to match next command comparing with where Matching failed, attempting to match next command comparing with monke Matching failed, attempting to match next command comparing with return Matching failed, attempting to match next command comparing with who Matching failed, attempting to match next command comparing with {p} what contains a parameter comparing with wins Matching failed, attempting to match next command comparing with corporate Matching failed, attempting to match next command comparing with they're Matching failed, attempting to match next command comparing with what comparing with can comparing with I comparing with say comparing with except comparing with {p} t contains a parameter Parsing line: I see this as an absolute win comparing with I comparing with like Matching failed, attempting to match next command comparing with right Matching failed, attempting to match next command comparing with no, Matching failed, attempting to match next command comparing with I comparing with see comparing with this comparing with as comparing with an comparing with absolute comparing with win Number of functions: 1 Parsing function: Iteration stopped at index 7 File parsing done, closing file... Starting parameter validity check Checking parameter main Parameter is a valid function name Starting parameter validity check Checking parameter rdi Parameter is a 64 bit register Checking parameter 1 Parameter is not a 64 bit register Parameter is not a 32 bit register Parameter is not a 16 bit register Parameter is not an 8 bit register Parameter is a decimal number Starting parameter validity check Checking parameter T Parameter is not an 8 bit register Parameter is a character, translated to: 'T' Starting parameter validity check Checking parameter e Parameter is not an 8 bit register Parameter is a character, translated to: 'e' Starting parameter validity check Checking parameter s Parameter is not an 8 bit register Parameter is a character, translated to: 's' Starting parameter validity check Checking parameter t Parameter is not an 8 bit register Parameter is a character, translated to: 't' Starting parameter validity check Label duplicity check for function in line 1 in file 0 Starting jump label validity check for opcode 20 Starting jump label validity check for opcode 22 Beginning Monke jump label validity check Starting analysis for "who would win?" command Starting analysis for "corporate needs you to find the difference..." command Chose random line for jump marker: 4 Starting analysis of the "Perfectly balanced..." command amount of times perfectly balanced was used: 0 amount of lines to be deleted: 0 Analysis done, freeing memory
System Info (please complete the following information):
develop
branch)TL;DR: pls mov rdi, 1
Example:
I like to have fun, fun, fun, fun, fun, fun, fun, fun, fun, fun main
who would win? eax or ebx
eax wins
What the hell happened here? eax >= ebx
I see this as an absolute win
ebx wins
What the hell happened here? eax < ebx
no, I don't think I will
In this example, exit code 0 is returned when eax is greater than or equal to ebx. If not, exit code 1 is returned. While this code is completely valid, the MemeASM compiler rejects it
Semantic Error in line 11: Statement does not belong to any function
Semantic Error in line 13: Statement does not belong to any function
This is because the analysis of a function is stopped when a return statement is found, meaning that other statements below it are ignored.
Hi, nice project :)
I would love to write a program that can output text, e.g. certain links, to stdout.
After a bit of research i got to the following asm snippet that works on Linux (Ubuntu 19.10) using the exact compile commands used in the program. It doesn't seem to work on Windows Subsystem for Linux though, there I get an Exec format error
.
Anyways, here's the content of tmp.asm
:
section .text
global main
main:
mov al, '!'
call writechar
ret
; Writes the ascii character in al to stdout
writechar:
push ebx
push ecx
push edx
push eax
mov edx, 1
mov ecx, esp
mov ebx, 1
mov eax, 4
int 128
pop eax
pop edx
pop ecx
pop ebx
ret
Compile & run:
nasm -f elf32 -o tmp.o tmp.asm
gcc tmp.o -g -o tmp -m32 -fno-pie -no-pie
./tmp
This outputs !
without any newlines etc, as expected. The same snippet also works in SASM.
I adapted the method from this site to get a version that works without any external dependencies, just some instructions.
Then I tried to add this to the translator.c
file, but I can't seem to get it right. I changed very little (just entries in the commandPatterns
and translationPatterns
arrays), the file is here.
The string to insert in translationPatterns
should probably be "push ebx\npush ecx\npush edx\npush eax\nmov edx, 1\nmov ecx, esp\nmov ebx, 1\nmov eax, 4\nint 128\npop eax\npop edx\npop ecx\npop ebx",
.
When I tried my change with a file that just contains much wow
(the command pattern for this, subject to change :D), it generates the following output in tmp.asm
:
section .text
global main
main:
line_1:
push ebx
push ecx
push edx
push eax
mov edx, 1
mov ecx, esp
add
ret
This doesn't compile and it's where I got stuck. It would be nice if you have any pointers on how to add the command. Thank you :)
Syntax | Usage |
---|---|
banana | sets a jump marker |
where banana | jumps to that jump marker |
Command Syntax: (e.g. stonks [register]
)
it's free real estate [register/number]
Command Description:
Allocates the provided number of Bytes on the Heap and returns a pointer to the starting address. If the allocation failed, 0
is returned. The memory block cannot be freed - because who does that anyway? (hides)
Which x86_64 Assembly instruction(s) would be used to translate this command?
For a possible implementation, see https://github.com/xarantolus/memeasm/blob/main/malloc/malloc.memeasm
What could this command be useful for?
Well.. heap allocation
What Meme is your command based on? (You can also provide a link to e.g. its KnowYourMeme page)
https://knowyourmeme.com/memes/its-free-real-estate
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.