All Projects → batman-nair → IRCIS

batman-nair / IRCIS

Licence: MIT license
I Run Chars I See(IRCIS) - a 2d grid based esoteric programming language.

Programming Languages

C++
36643 projects - #6 most used programming language
CMake
9771 projects
shell
77523 projects

Projects that are alternatives of or similar to IRCIS

Structurex
Javascript visualizer of algorithms and data structures.
Stars: ✭ 32 (-68.93%)
Mutual labels:  html-css-javascript
FashionShopApp
Fashion Shop App : Flask, ChatterBot, ElasticSearch, Recommender-System
Stars: ✭ 28 (-72.82%)
Mutual labels:  html-css-javascript
Bundli-Frontend
Bundli-Frontend 🚩 is a repo which contains 🚀different code of full stack Development 👨‍💻🚀
Stars: ✭ 133 (+29.13%)
Mutual labels:  html-css-javascript
QuickLearn
A collection of resources categorised by tech domains, languages, expertise and much more. QuickLearn gives you a quick access to all the resources that you could need at a single place, within a click!
Stars: ✭ 89 (-13.59%)
Mutual labels:  html-css-javascript
Hacktoberfest2021-for-everyone
This repository is for everyone who wants to participate in Hacktoberfest 2022. Anyone can contribute/add quality code or projects for your Swags (T- Shirt), must be relevant that can add some value to this repository.
Stars: ✭ 178 (+72.82%)
Mutual labels:  html-css-javascript
Portfolio-Saurav-Mukherjee
Portfolio website build using HTML5, CSS3, JavaScript and jQuery.
Stars: ✭ 48 (-53.4%)
Mutual labels:  html-css-javascript
snake-game-2D
The famous 2D snake game in which your goal is to eat until you get huge and accumulate many points.
Stars: ✭ 18 (-82.52%)
Mutual labels:  html-css-javascript
TruHealth
A website, which is wholly focused on Mental Health issues.
Stars: ✭ 16 (-84.47%)
Mutual labels:  html-css-javascript
facebook-clone
Building Facebook clone. As usual, any additional styling will be up to you but the really important stuff is to get the data and back end working properly.
Stars: ✭ 14 (-86.41%)
Mutual labels:  html-css-javascript
gtest-tap-listener
GoogleTest TAP Listener
Stars: ✭ 70 (-32.04%)
Mutual labels:  googletest
DevHelpBox
we are creating this community so that other developers can get benefits of it.
Stars: ✭ 35 (-66.02%)
Mutual labels:  html-css-javascript
Front-End-Xmind
前端知识体系思维导图,可以用于查缺补漏或者面试复习串联知识点,系统学习前端知识,加深记忆🎉🎉
Stars: ✭ 129 (+25.24%)
Mutual labels:  html-css-javascript
macos-preact
macos-preact.now.sh
Stars: ✭ 1,019 (+889.32%)
Mutual labels:  html-css-javascript
ParticleGround-Portfolio
A minimalistic particle theme landing page template. ⚛️
Stars: ✭ 335 (+225.24%)
Mutual labels:  html-css-javascript
MainakFolio
My Portfolio Website
Stars: ✭ 21 (-79.61%)
Mutual labels:  html-css-javascript
dextool
Suite of C/C++ tooling built on LLVM/Clang
Stars: ✭ 81 (-21.36%)
Mutual labels:  googletest
soak-your-brain-elearning-app
An e-learning platform built in python (django)
Stars: ✭ 18 (-82.52%)
Mutual labels:  html-css-javascript
CC33Z
Curso de Ciência da Computação
Stars: ✭ 50 (-51.46%)
Mutual labels:  html-css-javascript
Hacktoberfest21
Welcome to Open Source! 👨‍💻 Make your Hacktoberfest 2021 contribution here. Win a T-shirt and some stickers on completing 4 Pull Requests. (Made for beginners 🔰)
Stars: ✭ 13 (-87.38%)
Mutual labels:  html-css-javascript
-le-medicin
Official Repository for Intra SRM-MIC hackathon-Team Silicon
Stars: ✭ 15 (-85.44%)
Mutual labels:  html-css-javascript

Banner image

IRCIS is an esoteric programming language where the program exists in a two-dimensional grid of cells, where each cell contains a single instruction, and execution can proceed in any cardinal direction across this grid -- not just left-to-right, but also right-to-left, top-to-bottom, and bottom-to-top.

It has a vizualizer which creates an animated representation of the program execution in HTML and CSS.

Inspired by Befunge.

Hello World Vizualization

The program executes by reading the source file character by character and commands are executed based on the character read. This reading is done by a Runner object which starts from the top-left of the file and moves to the right. Based on the character read, the Runner object can change the direction of parsing, create more Runners, store/print/calculate values and more. Check out the command list to see all the commands implemented. The Visualizer helps in understanding the movement of these different Runner objects throughout the execution of the program.

Click on the HTML Link below the GIFs to see the actual generated html in its full glory

Character commands table

Character Commands
< > ^ v Movement control
+ - * / % ^ Arithmetic Ops in stack (in Integer mode)
& | V < > Binary Ops in stack (in Integer mode) V is XOR; <> shifts
# Print stack top to output
% Print stack top to output. Ints will be in base 64 chars
$ Print Newline
! End Processing
<space> . Blanks, Ignored
" Toggles Stack mode
' Goes to Integer mode
@<n> Push n'th index element of stack to top. @0 duplicates top
&<n> Pop n elements from stack
? Check stack top. If true then continue, else go right/left
* Split into multiple Runners
@<str> Push value in variable <str> to stack
&<str> Set value in stack top to variable <str>
r Generate a random 0 or 1 and push to stack
R Push random number between 0 and limit to stack
p Pause the Runner stack top number of ticks

Language Rules

Basic and Movement

  • Default/First Runner starts at first character of the source file(0, 0) and moves right from there.
  • The source file is transformed into a rectangular grid by padding blanks and processed as such.
  • '.' (dot) and ' ' (space) characters are considered blanks and are ignored.
  • Every Runner has its own stack.
  • Runner parses and executes commands based on the character read in the position of the Runner.
  • Movement of the Runner can be controlled using the characters '>', '^', 'v' and '>'.
  • A Runner dies if it reaches the end of Grid, sees an End Processing(!) character or in the event of an error.

Printing

  • Hash(#) is used to write values to output. It pops and prints the stack top value to output.
  • Dollar($) character starts a new line in the output.

Here you can see the basic movement and printing in the program

Basic movement gif HTML LINK

Stack operations

  • Stack push mode can be toggled with the double-quote(") character. In stack push mode, any character that comes in is pushed into the Runner stack as-is.
  • Integer mode can be used to push in integers and perform arithmetic operations. Integer mode processing starts on seeing a quote(') character.
  • Integer mode has precedence over stack mode. i.e "e'100.f In this piece of code, 'e' is pushed to stack followed by integer 100 then f. The '.' (blank) after 100 is not pushed to stack but acts as a separator to signify the end of Integer mode.
  • Integer mode ends on seeing a blank character.
  • Arithmetic operations are done when the operator is called in Integer mode.
  • Arithmetic operations on the stack are done as: If A and B are the values on the stack, B is stack top and addition(+) is the operation called, then A and B are popped from the stack and B+A is pushed back into the stack with operands in that order.
  • The <n>'th element from the stack top can be pushed to the top of the stack by specifying <n> after the stack push '@' operator.
  • Specifying <n> after the stack pop '&' operator, pops <n> elements from the stack.

Here you can see different arithmetic operations performed on numbers

Basic arithmetic example HTML LINK

Conditional

  • Question mark(?) is used for the conditional operation. It checks if the stack top value is non-zero.
  • If the top value is non-zero, execution continues in the current direction.
  • If the top value is zero, execution can go left or right depending on which side of the '?' there is a non-blank character. (Left and right here are with respect to the Runner object.)
  • Left has higher priority if both sides have a non-blank character.

Here the condition is checked to see if the loop number is divisible and to check if the end is reached

Basic condition example HTML LINK

Splitting/Creating more Runners

  • Star(*) character is used to create more Runner objects.
  • On seeing a star, Runners are created in every direction to the star that has a non-blank character.
  • The current Runner object continues in one of the split directions and new Runners are created if any, in other directions.
  • The new Runners have a copy of the original Runner's stack.

A split is done where one flow divides the number by 2 whereas the other gets the modulo by 2

Basic splitting example HTML LINK

Variables

  • Values can be saved to a variable by specifying a name <str> for the variable after the stack pop '&' operator. Saving to a variable doesn't pop the value from the stack.
  • Values can be pushed to stack from a variable by specifying the variable name <str> after the stack push '@' operator.
  • Variables names starting with an uppercase character are global variables and lowercase are local to the Runner instance. Global variables are accessible from any Runner no matter where it was set.
  • When a split happens the local variables are copied to both Runner instances.
  • When 2 Runner instances try to write the same global variable in the same step, the value in the global variable depends on the Runner update order.

A local 'limit' variable is used to store the loop end value, Global 'Flag' is used to check if Fizz or Buzz has been printed

Variables used to keep limit HTML LINK

Random values and Visual Pause

  • 'r' operator generates a random 0 or 1 value and pushes to stack.
  • 'R' operator pops a limit value from stack and generates a random value between 0 and limit and pushes it to stack.
  • 'p' operator pauses Runner execution stack top number of ticks. The stack top is popped.

Random values and pauses are used to create a racing track for Runner's with random paths and random pauses.

Racetrack for runners with randoms and pauses HTML LINK

How to compile and run

When cloning the repo, use git clone --recursive so that googletest module is also cloned in.

Run ./build.sh to compile the program with the tests and create the final executable with a single command. Manual building can be done using cmake. Run ./build.sh Debug to build with additional printing of DEBUG messages of the run. It also dumps a debug.log file with the run status.

You can run the program with

./ircis examples/hello_world.txt

You can run the program on multiple input grids sequentially by just supplying additional parameters, like

./ircis examples/hello_world.txt /examples/fizbuzz.txt

This will give the output in the console and generate the html vizualization of the final input file as output.html

Options

Normally, the runner starts at (0, 0) and headed East. You can specify the starting position of the initial runner and its direction with the options

-x,--startx num         Starting x position (Default: 0)
-y,--starty num         Starting y position (Default: 0)
-d,--direction [NSEW]   Specify the starting direction (Default: E)
-s,--speed num          Set the speed for generated animation (Default: 15)

You can see how this works with these examples:

./ircis examples/options.txt
./ircis examples/options.txt -x 49 -y 21 -d N
./ircis examples/options.txt -x 2 -y 2 -d S
./ircis examples/options.txt --startx 59 --starty 12 --direction W

Contributing

If you have some cool feature to add or see, feel free to raise a PR or issue to let us know! :)

Contributors: @bhudgeons(++features), @prathyvsh(the cool banner)

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].