Ndef

From Esolang
Jump to: navigation, search

Ndef is an esoteric programming language invented by User:$M@.

Language overview

In ndef every source code generates undefined behavior. Therefore, any compiler in any language is a valid ndef compiler.

Depending on the compiler/hardware,

  • source codes may be textual or non-textual
  • computational class may be anything (see related section)
  • it may or may not be useful

Examples

Using the right compiler, the following program solves the halting problem:

* include algs.uni

#hp (:= new .problem(.famous_problems.halting) )
.solve #hp
;

Unfortunately, the appropriate compiler for the above code has not been found yet. Some sceptics say such compiler does not exist.

Examples for The Author's Canonical Interpreter (TACI)

The following prints "Hello World!":

8168862;22966872;15457832;61224440;24793640;11456088;131756776;23713336;10891880;66740184;2727062;17479004;254918578;11259608;25055848;61535800;15097320;22688344;128570920;8715874;30425778;57037400;14301160;28299832;528121448;10932952;32126504;56513144;11128360;33191384;10268130;122700210;31347432;11269720;59563682;22037362;15953391;262927320;25054824;11194936;53526866;3902606;19242249;133186034;23746088;7150060;55591382;13616818;28126972;1058982732;12471848;23778040;61240872;14406232;24002024;129652280;11921788;28193336;51295708;15611512;28987944;11790060;256949974;32621490;57397992;5596972;18646299;10891896;122095599;32100952;10909416;58380856;28200552;14300120;526898728;27947640;16703016;61485784;23484008;14283320;128601576;25089624;11153960;62093804;13648310;25411046;252267740;10931768;23745128;7151404;51376513;22695400;133050968;12244520;23491320;61464104;4346673;32913025;2142958136;15093352;28037848;56505896;15356536;27721256;125457880;4313809;24626006;13648370;62204220;22069622;8744358

This program prints all characters #0-255:

2722954;17521484;7254934;55592786;17386812;4632371

This prints squares from 0 to 10000:

8168862;22966872;15457832;61224440;16250038;17488764;133415250;23713336;10891880;66740184;11465256;24550463;265798354;14587790;32277769;13969180;58192257;21953439;128570920;16675576;27971112;57037400;8759906;31753727;14063486;522121603;33520879;55253183;3052470;17546236;6235948;118147932;20038002;16612002;53534418;28308543;15095336;256919378;5673886;17723779;62534248;8739490;23491288;8208156;118624897;23514712;63379631;9430690;27971320;1058899231;15439774;31819033;58351160;11416168;28700460;122201611;2723198;17985411;56218152;8694498;5466412;249077259;8369310;20321923;12410466;56260136;27906648;14139762;132027574;15652456;46704155;3116430;18247555;14300120;526898728;27947640;16703016;61485784;9427682;23786024;132011768;15229305;17388740;65655416;12219944;31388465;16416312;255210369;25102767;64616152;11424296;24788600;128373288;15365592;23055976;61493816;9694255;30345375;2137947688;8627810;27708984;52266271;7337886;18223491;11988015;129507691;23903515;5133649;50771788;19171103;11419640;257675816;31880792;8609378;56083122;3051406;17553220;129969140;17518404;11260472;5156145;50810684;23580120;531247720;16668216;27980520;11876652;50943324;27908088;125727272;7808876;33058315;6010046;51517059;28201704;257687096;15094376;27932632;58642984;11161208;31060520;124147416;9565231;4306385;18435020;58497823;25407138;1060127474;2751934;18748291;15327208;56242744;28202600;16446168;128339496;23843448;14562856;61496792;9397730;31402780;256500283;16076747;18225025;66111474;11035119;23364895;7795614;121508227;33011702;51253633;14407208;28200440;13965620;534434408;20536772;12697553;50978252;32557010;9694319;120636146;3569598;19170617;65593833;17422148;15619560;259016402;8297886;18593220;62535208;19974098;2722974

A small 3D space flying demo:


(an empty file)

Computational class

Strictly speaking, the computational class of ndef is an empty set of problems. However, well-documented compilers may provide additional computational complexity. That being said, many Turing-complete compilers/interpreters exist. However, most interpreters are not Turing complete, for example the famous real-time interpreter notepad.exe handles all characters as NOP.

Given the right hardware, programs may even solve problems beyond the scope of Turing completeness (see example above).

Compilers, interpreters

Some of the most famous Turing-complete compilers:

Note that most compilers have very high error-levels, and won't compile many legal ndef source codes. This is merely for safety reasons, and is in fact encouraged behaviour. To learn what kinds of ndef codes are accepted, consult the compiler's documentation.

TACI

TACI is a Turing-complete interpreter for ndef. TACI enforces very strict syntax (for a greater good, of course). It accepts textual source codes which contain 32-bit unsigned integers separated by semicolons. (The exact documentation is out of the scope of this article, but don't hesitate to try it out, it gives fair error messages.)

Coding for TACI can be considered an esoteric language by itself. (Maybe it should have its own article?) It is famous for interpreting the 3D game with the shortest source code.