Talk:Assemblyfuck

From Esolang
Jump to navigation Jump to search

My idea for making a compiler

Tags

To make tags my idea is that the program runs on an infinite loop, like this:

+[code]

But that doesn't do anything, so my idea is that the first two cells of the tape of any program looks like this:

cell #1: 255
cell #2: 1
cell #3: 0
cell #4: 0
cell #5: 0

The cell #1 is a cell that you can come to it later by easily writing this +[-<+]-
The cell #2 is the cell that marks which tag is running right now
The cell #3 is just for doing a equality algorithm
The cell #4 is also for doing the equality algorithm
The cell #5 is just for breaking loops

->+[
if tag 1[code+[-<+]->>>>]
+[-<+]->if tag 1[code+[-<+]->>>>]
+[-<+]->if tag 2[code+[-<+]->>>>]
+[-<+]->if tag 3[code+[-<+]->>>>]
etc
end of code loop+[-<+]->]

by doing that you can only have 255 tags which isn't enough. The new code is:

  start of program
->+[
  copy tag cell so equal algorithm doesnt break it
>[-]<[->+>+<<]>>[-<<+>>]<<
  detect if tag equals 1
>>+<<-[>>-<<[-]]
  tag 1 code
>>[>>
  ||||| TAG 1 CODE |||||
    ==end of tag 1 code
  fix tag cell because equal algorithm did break it
+[-<+]->>[-<+>]
  break tag 1 loop
>[-]>
] end of tag 1 code loop
<<< end of program loop
]

I think my comments are understandable, right?. A program that does have 6 tags looks like this:

  start of program
->+[
  copy tag cell so equal algorithm doesnt break it
>[-]<[->+>+<<]>>[-<<+>>]<<
  detect if tag equals 1
>>+<<-[>>-<<[-]]
  tag 1 code
>>[>>
  ||||| TAG 1 CODE |||||
    ==end of tag 1 code
  fix tag cell because equal algorithm did break it
+[-<+]->>[-<+>]
  break tag 1 loop
>[-]>
] end of tag 1 code loop
copy tag cell so equal algorithm doesnt break it
>[-]<[->+>+<<]>>[-<<+>>]<<
  detect if tag equals 2
>>+<<--[>>-<<[-]]
  tag 2 code
>>[>>
  ||||| TAG 2 CODE |||||
    ==end of tag 2 code
  fix tag cell because equal algorithm did break it
+[-<+]->>[-<+>]
  break tag 2 loop
>[-]>
] end of tag 3 code loop
copy tag cell so equal algorithm doesnt break it
>[-]<[->+>+<<]>>[-<<+>>]<<
  detect if tag equals 3
>>+<<---[>>-<<[-]]
  tag 3 code
>>[>>
  ||||| TAG 3 CODE |||||
    ==end of tag 3 code
  fix tag cell because equal algorithm did break it
+[-<+]->>[-<+>]
  break tag 3 loop
>[-]>
] end of tag 4 code loop
copy tag cell so equal algorithm doesnt break it
>[-]<[->+>+<<]>>[-<<+>>]<<
  detect if tag equals 4
>>+<<----[>>-<<[-]]
  tag 4 code
>>[>>
  ||||| TAG 4 CODE |||||
    ==end of tag 4 code
  fix tag cell because equal algorithm did break it
+[-<+]->>[-<+>]
  break tag 4 loop
>[-]>
] end of tag 4 code loop
copy tag cell so equal algorithm doesnt break it
>[-]<[->+>+<<]>>[-<<+>>]<<
  detect if tag equals 5
>>+<<-----[>>-<<[-]]
  tag 5 code
>>[>>
  ||||| TAG 5 CODE |||||
    ==end of tag 5 code
  fix tag cell because equal algorithm did break it
+[-<+]->>[-<+>]
  break tag 5 loop
>[-]>
] end of tag 5 code loop
copy tag cell so equal algorithm doesnt break it
>[-]<[->+>+<<]>>[-<<+>>]<<
  detect if tag equals 6
>>+<<------[>>-<<[-]]
  tag 6 code
>>[>>
  ||||| TAG 6 CODE |||||
    ==end of tag 6 code
  fix tag cell because equal algorithm did break it
+[-<+]->>[-<+>]
  break tag 6 loop
>[-]>
] end of tag 6 code loop
<<< end of program loop
]

code is slooooooooooooooooooooooooow but this assembly wasn't mean to be compiled to brainfuck (unlike BF-ASM:8)