IDlang
Jump to navigation
Jump to search
IDlang is language derived from BF.
Commands
Command | Meaning |
---|---|
+ | increment current cell |
- | decrement current cell |
> | move pointer to the right |
< | move pointer to the left |
. | output cell as number.(why you need outputing cells as characters?) |
, | input number and store it in current cell |
! | skip every instruction until next ! if 0 |
? | skip every instruction until next ? if 0 |
^ | jump to start of program if cell not 0 |
IDmini
IDmini is minimazisation of IDlang
Step 1. Combining input and output(8 instructions)
+-<>;!?^
;
is ,
when 0 and .
otherwise
Step 2. Combining > and +(7 instructions)
}-<;!?^
} is >+
in previous step
Step 3. - deleted(6 instructions)
}<;!?^
You don't need - when cell is 8 bits
Step 4. Combining } and !(5 instructions)
<;)?^
) is }!
Step 5. Deleting ?(4 instructions)
<;)^
)
will now skip next instruction if 0, so ?
is unnesesary
Step 6. Deleting ^(3 instructions)
<;)
After executing program will be run command ^
So command list is:
< |
move pointer to the left |
; |
if cell is 0 input, else output |
) |
move pointer to the right, increment cell and if it is more than 255 set to 0. Skip next instruction if 0 |
end of the program | if cell is not 0 back to start of program |
BITlang
BITlang is another minimisation of IDlang.
Step 1. make cells 1-bit long(8 instructions)
*<>.,!?^
No explanation needed.
Step 2. memory-mapped IO(7 instructions)
*<>;!?^
if cell is not zero input number and store it in next 8 cells. If cell is zero output next 8 bits.
Step 3. Make ! skip next command(6 instructions)
*<>;!^
!
is now skip only next command, so ?
is not necessary
Step 4. Combine * and >(5 instructions)
<>;!^
>
is *>
in previous step
Step 5. Combine < and !(4 instructions)
>;{^
{
is a <!
in previous step
Step 6. Combine { and ^(3 instructions)
>;]
]
is interpretetated as ^
if there isn't another ]
after. Otherwise it is interpreted as {
.
Translation from 1-bit IDlang
From 1-bit IDLang to BITlang:
1-bit IDlang | BITlang |
---|---|
> |
>]] >
|
< |
]] followed by space
|
* |
>]] followed by space
|
! and ? |
>]] >]] after every command
|
^ |
]
|
From BITlang to 1-bit IDlang:
BITlang | 1-bit IDlang |
---|---|
> |
*>
|
] |
^ if there isn't another ] after it. If there is, then <!
|