Blue Hens
Jump to navigation
Jump to search
Blue Hens is an interpreted programming language by User:ProfNinja designed for a CTF competition, inspired by Chicken.
Language Overview
Your input is a text file.
Each line may have the word "blue" some number of times followed by the word "hens" some number of times, space-separated.
The number of "blues" on the line is the OPCODE the number of "hens" on that line is the ARG.
The line numbers matter and they start at 1.
Our architecture has 2 variables, a register REG and a counter CTR both start at 0.
OPCODES 1,2,3,4 are arithmetic operations
OPCODES 5,6,7 are gotos
OPCODES 8,9,10 are control flow:
OPCODE 11 is print
The OPCODEs
There are 11 opcodes:
OPCODE | MNEMONIC | ARG? | DESCRIPTION OF CODE |
---|---|---|---|
1 | SET | Y | Set REG to ARG |
2 | ADD | Y | Add ARG to REG |
3 | SUB | Y | Sub ARG from REG |
4 | MUL | Y | Multiply REG by ARG |
5 | GTL | Y | Goto line ARG |
6 | GBL | Y | Go back ARG lines |
7 | GUL | Y | Go up ARG lines |
8 | CTA | Y | Add ARG to CTR |
9 | CTS | Y | Sub ARG from CTR |
10 | SKP | N | If CTR 0 skip next line |
11 | PRT | N | Print REG (ascii) |
Examples
The Hello, World! program:
blue blue blue blue blue blue blue blue blue blue blue blue blue blue blue blue blue hens hens hens hens hens hens hens hens hens hens hens hens hens hens hens hens hens hens hens hens hens hens hens hens hens hens blue blue blue blue blue blue blue blue hens blue hens hens hens hens hens hens blue blue blue blue hens hens hens hens hens hens blue blue blue blue hens hens blue blue blue blue blue blue blue blue blue hens blue blue blue blue blue blue blue blue blue blue blue blue blue blue blue blue blue hens hens blue blue blue blue blue blue blue hens hens hens hens hens hens hens hens hens hens hens hens hens hens hens hens hens hens hens blue blue blue hens hens hens blue blue blue blue blue blue blue blue blue hens blue blue blue blue blue blue blue blue blue blue blue blue blue blue blue blue blue hens hens blue blue blue blue blue blue blue hens hens hens hens hens hens hens hens hens hens hens hens hens hens hens hens hens blue blue hens hens hens hens hens hens hens blue blue blue blue blue blue blue blue blue hens blue blue blue blue blue blue blue blue blue blue blue blue blue blue blue blue blue hens hens blue blue blue blue blue blue blue hens hens hens hens hens hens hens hens hens hens hens hens hens hens hens blue blue blue blue blue blue blue blue blue hens blue blue blue blue blue blue blue blue blue blue blue blue blue blue blue blue blue hens hens blue blue blue blue blue blue blue hens hens hens hens hens hens hens hens hens hens hens hens hens hens blue blue hens hens hens blue blue blue blue blue blue blue blue blue hens blue blue blue blue blue blue blue hens hens hens hens hens hens hens hens hens hens hens hens hens hens blue blue blue blue blue blue blue hens hens hens hens hens hens hens hens hens hens hens hens hens hens hens hens hens hens hens blue blue blue blue blue blue blue blue blue blue blue blue blue blue blue blue blue blue blue hens hens blue blue blue blue blue hens hens hens hens blue blue blue blue blue blue blue blue blue blue blue blue blue blue blue blue blue blue blue hens hens hens blue blue blue blue blue hens hens hens hens blue blue blue blue blue blue blue blue blue blue blue blue blue blue blue blue blue blue blue hens hens hens hens blue blue blue blue blue hens hens hens hens blue blue blue blue blue blue blue blue blue blue blue blue blue blue blue blue blue blue blue hens hens hens hens hens blue blue blue blue blue hens hens hens hens blue blue blue blue blue blue blue blue blue blue blue blue hens hens hens hens blue blue blue blue hens hens hens hens blue blue blue blue hens hens blue blue blue blue blue blue blue blue blue blue blue blue blue blue blue blue blue blue blue hens blue hens hens hens hens hens hens hens hens hens hens hens blue blue blue blue hens hens hens hens hens hens hens hens blue blue blue hens blue blue blue blue blue blue blue blue blue hens blue blue blue blue blue blue blue blue blue blue blue blue blue blue blue blue blue hens hens blue blue blue blue blue blue blue hens hens hens hens hens hens hens hens hens hens hens hens hens hens hens hens hens hens hens hens hens blue blue blue hens hens hens hens hens hens hens hens blue blue blue blue blue blue blue blue blue hens blue blue blue blue blue blue blue blue blue blue blue blue blue blue blue blue blue hens hens blue blue blue blue blue blue blue hens hens hens hens hens hens hens hens hens hens hens hens hens hens hens hens hens hens hens blue blue hens hens hens blue blue blue blue blue blue blue blue blue hens blue blue blue blue blue blue blue blue blue blue blue blue blue blue blue blue blue hens hens blue blue blue blue blue blue blue hens hens hens hens hens hens hens hens hens hens hens hens hens hens hens hens hens blue blue blue hens hens hens hens hens hens blue blue blue blue blue blue blue blue blue hens blue blue blue blue blue blue blue blue blue blue blue blue blue blue blue blue blue hens hens blue blue blue blue blue blue blue hens hens hens hens hens hens hens hens hens hens hens hens hens hens hens blue blue blue hens hens hens hens hens hens hens hens blue blue blue blue blue blue blue blue blue hens blue blue blue blue blue blue blue blue blue blue blue blue blue blue blue blue blue hens hens blue blue blue blue blue blue blue hens hens hens hens hens hens hens hens hens hens hens hens hens blue blue blue blue blue blue blue blue blue blue blue blue blue blue blue blue blue blue blue hens hens blue blue blue blue blue hens hens blue blue blue blue blue blue blue blue blue blue blue blue blue blue blue blue blue blue blue hens hens hens blue blue blue blue blue hens hens blue blue blue blue blue blue blue blue blue blue blue blue blue blue blue blue blue blue blue hens hens hens hens blue blue blue blue blue hens hens blue blue blue blue blue blue blue blue blue blue blue blue blue blue blue blue blue blue blue hens hens hens hens hens blue blue blue blue blue hens hens blue blue blue blue blue blue blue blue blue blue blue
Implementation
A compiler from opcode arg to 'blue's and 'hens'