JR

From Esolang
Jump to navigation Jump to search

JR is a Deadfish variant with more commands.

Syntax

Commands are made up of one character. Just type the symbol.

Data is stored in an 8-cell array. Use the < and > commands to change cells.

Line breaks and spaces can be used to format code.

Commands

There are 10 commands recognized by JR:

Command Function Deadfish command
[ Decrements the current cell. d
] Increments the current cell. i
; Squares the current cell. s
. Prints the current cell numerically. o
, Prints the current cell as ASCII.  
@ Resets the current cell to 0.  
! Prints the source of your program.  
~ Clears the console.  
< Moves the cell pointer to the left.  
> Moves the cell pointer to the right.  

Sample programs

Hello World

]]];[;]]]]]]]],
@]];]]];[[[[[
>]]];];],]]]]]]],,]]],
<,[[[[[[[[[[[[,
>>]]];]];[[,
<,]]],[[[[[[,
@]]];];,
<],

Quine

!

Interpreter

A simple interpreter written in Ruby in the style of a Trivial brainfuck substitution.

#!/usr/bin/ruby
s=ARGF.read;eval 'm=Hash.new(p=0);'+s.gsub(/./,
     '[' => 'm[p]-=1;',
     ']' => 'm[p]+=1;',
     ';' => 'm[p]*=m[p];',
     '.' => 'print m[p].to_s;',
     ',' => 'putc m[p];',
     '@' => 'm[p]=0;',
     '~' => 'print "\033[2J\033[H";',
     '>' => 'p+=1;',
     '<' => 'p-=1;',
     '!' => 'print s;',
)

External resources

Online JR Interpreter (written by Ethan, the author of the language)(dead link)

Common Lisp implementation of the JR programming language.