8ial

From Esolang
(Redirected from 13ial)
Jump to navigation Jump to search

8ial (or 8 instruction assembly language) is basically self explanatory. It's an 8 instruction assembly language created by User:Ractangle.

Syntax

8ial has 16 regestries which can hold intergers that are in 0-255 radius

INC INCremenet a registry
PSH PuSH a registry
;A creates label A
OUT OUTput the top of the stack
JMP JuMP to a label unconditionally
PUT inPUT into registry
JIR Jump to a label If Registry is equal to a number
DEC DECremenet a registry

To halt a program, you need to reach the EOF.

A EBNF formulation of the (outdated) syntax is shown bellow:

program         := { innerLine } , [ finalLine ] ;
innerLine       := [ command ] , [ comment ] , newlines ;
finalLine       := [ command ] , [ comment ] ;
comment         := "!" , { character - newline } ;
command         := evrCommand | jirCommand | labelDefinition | outCommand | ptrCommand | pshCommand | putCommand ;
evrCommand      := "EVR" , numericOperand ;
jirCommand      := "JIR" , labelName , registry , numericOperand ;
labelDefinition := ";" , labelName ;
outCommand      := "OUT" ;
ptrCommand      := "PTR" , registryName ;
pshCommand      := "PSH" , registryName ;
putCommand      := "PUT" , registryName ;
labelName       := labelCharacter , { labelCharacter } ;
labelCharacter  := digit | letter | "-" | "_" ;
numericOperand  := signedInteger | registryName ;
registryName    := "$" , unsignedInteger ;
signedInteger   := [ "+" | "-" ] , unsignedInteger ;
unsignedInteger := digit , { digit } ;
digit           := "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" ;
letter          := "a" | ... | "z" | "A" | ... | "Z" ;
newlines        := newline , { newline } ;
newline         := "\n" ;
space           := " " | "\t" ;

Examples

Truth-machine

PUT $1
;d
JIR x $1 0
JIR o $1 1
DEC $1
JMP d
;x
PSH $1
OUT
JMP e
;o
PSH $1
OUT
JMP o
;e

Cat program

It's more of a numeric cat considering that 8ial only supports numbers

;repeat
PUT $1
PSH $1
OUT
JIR x $1 0 
JMP repeat
;x

Interpreter