Uppercase=Lowercase

From Esolang
Jump to navigation Jump to search
This article is not detailed enough and needs to be expanded. Please help us by adding some more information.

Uppercase=Lowercase is an esolang by User:ChuckEsoteric08.

Specification

When you input or output lowercase ASCII character it would be treated as uppercase character instead. *x would return value of cell .

Cells are 1-indexed

Instruction Description
lbl x Declare label x
inc x y Increment cell x by y
dec x y z If cell x is less than y goto label z. Else decrement cell x by y
inp x Set cell x to user input
out x Output cell x as ASCII character.

Examples

Cat program

An infinitely repeating cat program shall be demonstrated:

lbl start
inp 1
out 1
dec 1 256 start

Truth-machine

This program implements a truth-machine:

inp 1
inc 2 *1

dec 1 48 terminate_on_error
dec 1 1  end_if_zero

lbl repeat_if_one
out 2
dec 2 50 repeat_if_one

lbl end_if_zero
out 2

lbl terminate_on_error

Hello, world!

This program outputs the message “HELLO, WORLD!” using indirect references and the conditional goto facility:

inc  1 72
inc  2 69
inc  3 76
inc  4 76
inc  5 79
inc  6 44
inc  7 32
inc  8 87
inc  9 79
inc 10 82
inc 11 76
inc 12 68
inc 13 33

inc 14 1
inc 15 12

lbl print
out *14
inc  14  1
dec  15  1 end
dec  15 15 print

lbl end

brainfuck interpreter

// Memory is lied like this:
// IP,CP,Nesting depth, cell for unconditional jumps, 0, program, 0, Memory
// input is seperated from program by ! like in dbfi
// If you try to decrement 0 or IP goes out of bounds three exclamation marks would be printed and progam will halt
// set IP to 5
set 1 5
// start inputing
lbl input
inc 1 1
inp *1
dec *1 34 finsishinput
inc *1 34
dec 4 1 input
lbl finishinput
dec *1 33
set 2 1
inc 2 1
set 1 5
lbl interpet
inc 1 1
// if zero halt
dec *1 1 end
inc *1 1
// if 43 increment
dec *1 44 inc
inc *1 44
// if 44 input
dec *1 45 inp
inc *1 45
// if 45 decrement
dec *1 46 dec
inc *1 46
// if 46 output
dec *1 47 out
inc *1 47
// if 60 previous cell
dec *1 61 prev
inc *1 61
// if 62 next cell
dec *1 63 next
inc *1 63
// if 91 start loop
dec *1 92 startl
inc *1 92
// if 93 end loop
dec *1 94 endl
inc *1 94
dec 4 1 interpret
// +
lbl inc
inc *2 1
dec 4 1 interpret
// -
lbl dec
dec *2 1 error
dec 4 1 interpret
// >
lbl next
inc 2 1
dec 4 1 interpet
// <
lbl prev
dec 2 1 error
dec 4 1 interpet
// .
lbl out
out *2
dec 4 1 interpret
// ,
lbl inp
inp *2
dec 4 1 interpret
// [
lbl startl
// if cell is zero go back to matching ]
dec *2 1 nextcmd
inc *2 1
dec 4 1 interpet
// loop until matching ]
lbl nextcmd
inc 1 1
// if there is no instruction under IP then error
dec *1 1 error
inc *1 1
// if symbol is not [ or ] do nothing
dec *1 44 nextcmd
inc *1 44
dec *1 45 nextcmd
inc *1 45
dec *1 46 nextcmd
inc *1 46
dec *1 47 nextcmd
inc *1 47
dec *1 61 nextcmd
inc *1 61
dec *1 63 nextcmd
inc *1 63
// if symbol is [ inc nesting depth
dec *1 92 incnest
inc *1 92
// if symbol is ] dec nesting depth
dec *1 94 decnest
dec 4 1 nextcmd
lbl incnest
inc 3 1
dec 4 1 nextcmd
lbl decnest
// try to decrement nesting depth
// if it was already zero end loop
dec 3 1 interpet
dec 4 1 nextcmd
// ]
lbl endl
// if cell is zero continue executing
dec *2 1 interpret
inc *2 1
// loop until matching [
lbl prevcmd
dec 1 1 error
// if there is no instruction under IP then error
dec *1 1 error
inc *1 1
// if symbol is not [ or ] do nothing
dec *1 44 nextcmd
inc *1 44
dec *1 45 nextcmd
inc *1 45
dec *1 46 nextcmd
inc *1 46
dec *1 47 nextcmd
inc *1 47
dec *1 61 nextcmd
inc *1 61
dec *1 63 nextcmd
inc *1 63
// if symbol is [ inc nesting depth
dec *1 92 incnest2
inc *1 92
// if symbol is ] dec nesting depth
dec *1 94 decnest2
dec 4 1 prevcmd
lbl incnest2
inc 3 1
dec 4 1 prevcmd
lbl decnest2
// try to decrement nesting depth
// if it was already zero end loop
dec 3 1 interpet
dec 4 1 prevcmd
// if error print !!! and halt
lbl error
dec *1 print!
dec 4 1 error
lbl print!
inc *1 33
out *1
out *1
out *1

Interpreter

  • Common Lisp implementation of the Uppercase=Lowercase programming language.