Ni

From Esolang
Jump to navigation Jump to search
Ni
Paradigm(s) Imperative paradigm
Designed by User:DeybisMelendez
Appeared in 2020
Memory system Cell-based
Dimensions One-Dimensional
Computational class Turing Complete
Major implementations Lua by User:DeybisMelendez
Influenced by Brainfuck
File extension(s) .nic, .ni
Ni Logo

Ni is an esoteric programming language influenced by brainfuck. The name Ni comes from Nicaragua. Created by User:DeybisMelendez.

Language Overview

Like brainfuck, Ni operates on a tape containing cells, cells can store 64-bit integers. The cells are pointed by a head, the head can move from left to right or jump to a cell directly. There is also a clipboard where you can store data from one cell and insert any other.

Commands

Command Description
> Move the head to the right
< Move the head to the left
+ Increment the targeted cell
- Decrement the targeted cell
@ Reads the first character, converts it to its ASCII number and stores it in the pointed cell
. Print the number stored in the targeted cell
! Print the ASCII equivalent of the number stored in the pointed cell
# Set a hexadecimal number in the pointed cell
? Copy the number of the pointed cell
= Stores the copied number in the pointed cell
* Converts the number of the pointed cell to 0
$ Moves the spindle to the cell indicated with a hexadecimal number
[] (While) Loop that continues execution if the pointed cell is not equal to 0
{} (For) Loop that executes the instructions the number of times that the memory of the pointed cell indicates
() (if) Executes the set of instructions if the pointed number is equal to the clipboard
/ Ignore the rest of the line

Examples

Hello World!

#48!#65!#6c!!#6f!#20!#57!#6f!#72!#6c!#64!#21!#a!

Cat program

+[@!#a!]

Truth-machine

@>#30[<->-]<.[.]

Fibonacci

#a>>+.<<!>>>>#1f{<<?>=<<[>>+<<-]>?<=>>?<=.<<!>>>>}

Factorial

#0 /Insert the number to calc, #0 prints 1, #9 prints 362880, etc.
(+.*)[?>=-[-<{>{<+>}<}>]<.*]

Computational class

Ni is Turing-complete, as ><+-@![] correspond directly to brainfuck's ><+-,.[].

External resources

Official Github page of Ni

Online Interpreter