Lightlang

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.

Lightlang is an esoteric programming language designed by User:Felixcesar15 that only uses 1 bit as memory.

Instructions

Each character is an instruction (like brainfuck) (Note: any invalid instruction is ignored so you can comment your hardworked code).

  • ^ - Toggle the bit.
  • ! - Print the state of the bit (as 0 or 1).
  • ? - Ask for input, if it's nothing, turn the bit on, otherwise turn the bit off.
  • @ - Set the bit to random state.
  • & - If the bit is on, don't read the next instruction, otherwise do nothing.
  • # - Halt the program.
  • < - Jump to the start of the program
  • / - Reverse the direction of the instruction pointer.
  • _ - Sleep for 1 second.

Examples

Hello, world!

'Hello, world!' as the concatenation of 7 bit strings corresponding to each character's ASCII value:

^!^!!^!^!!!^!!^!!^!^!^!!!^!^!!^!!^!!^!^!!^!!^!!^!^!!!!^!^!^!^!!^!!!^!^!!!!!^!!!^!^!!!!!^!^!!!!!!!^!!^!^!^!!^!^!!^!!^!!^!!^!^!!!^!^!!!!^!

With comments:

     code     | letter |  ASCII  
---------------------------------
^!^!!^!^!!!   | H      | 100 1000
^!!^!!^!^!^!  | e      | 110 0101
!!^!^!!^!!    | l      | 110 1100
^!!^!^!!^!!   | l      | 110 1100
^!!^!^!!!!    | o      | 110 1111
^!^!^!^!!^!!  | ,      | 010 1100
!^!^!!!!!     |        | 010 0000
^!!!^!^!!!    | w      | 111 0111
!!^!^!!!!     | o      | 110 1111
!!!^!!^!^!    | r      | 111 0010
^!!^!^!!^!!   | l      | 110 1100
^!!^!!^!^!!   | d      | 110 0100
!^!^!!!!^!    # !      | 010 0001

This will print the bit, toggle it then repeat

!^<

Same as above but it has a delay

!^_<

This will print 1 if the input is nothing (Non-terminating)

?!<

Same as above but terminating

?!

Truth-machine

Enter nothing for input 0.

?!&#&/!/

Implementations

A Python interpreter by User:Bangyen.