ChuckScript

From Esolang
Jump to: navigation, search
ChuckScript
Paradigm(s) imperative
Designed by Andrés Ortiz
Appeared in 2016
Computational class Turing complete
Major implementations Original interpreter in javascript
Influenced by Unary
File extension(s) .cnpl


ChuckScript is an esoteric programming language designed by Andrés Ortiz based on the concepts of Unary, where all the code is written using only zeroes. The language was designed as a joke on how Chuck Norris code.

Language Overview

ChuckScript uses the same concept as Unary to translate code into zeroes. However, instead of using Brainfuck as base language, it can use any text (and language). This would generate huge files (several exabytes for a Hello World), so instead of storing the string of zeroes, only the number of zeroes will be stored, using the following format:

[0]{9582516168086304533950061199088375933762201813077804024987245718616842}

Hello_World.cnpl

ChuckScript Generation

The syntax is based on the regex that would match the given number of zeroes in a text file.

In order to translate a text file into chuckscript, the following steps must be followed:

  1. Translate the file into binary
  2. Add "1" at the beginning
  3. Translate the number to decimal
  4. Put the number with the ChuckScript format

For example: The text "Hello" would translate to 01001000 01100101 01101100 01101100 01101111 in binary. Prepending the 1, we get 10100100001100101011011000110110001101111, which, in dec is 1410450877551, resulting in [0]{1410450877551}

Interpreter

While ChuckScript may be implemented with any language, the original interpreter (cni) runs on top of JavaScript using Node.js

All ChuckScript files use the extension .cnpl

Unary File Size

ChuckScript uses the reduced syntax [0]{...} instead of only zeroes due to the extreme size of unary files. The size of Unary programs limit Unary syntax. For example, the Hello World program would require ~9.58* 10^51 Exabytes of space vs the 76 bytes needed using the ChuckScript syntax.

Examples

These examples are using JavaScript as base language [0]{9582516168086304533950061199088375933762201813077804024987245718616842}

Hello_World.cnpl: Basic Hello World

[0]{128480536267270702633263631096697390863184481716477179022037631861412548099855931198072928281042368706556936273149175436273819880265408401547429336355290289322705866717808872277668655389807052961769213491193904192423423802634}

Loop.cnpl: An iteration from 0 to 9, showing the current iteration number on console

[0]{88703523001131395011568035053805112393172583886475322390926574377727964578993987192524078996589911218864803945644069156915920798371343066115756089440843714680823595238277761827604237327188482417717538861617192995757166310990050884416743903040285306082464506446882692991470451098185740887277422187465368475377944160217567864501419751289221101080892917908489930574052325777083370782930082094064979308435662610980167123435380219516438280285218632237493404411566320694842134561368035893497309629319751323661908457233099694629368298773739489209597901154034498679513939664235286857667145856479116683234083977466528083881545249301749567617985557121923148114140111059353841366929773120257896376195770617197331154005860332706938709271356370968390256147204985491564126891806395855832559100204422574708586279129193027058639536933282356114574176702549448542907991063686324765416045322}

server.cnpl: Simple Http webserver (requires running under Node.js)

Links