Shortest infinite loop producing no output

124

23

Your task is to create the shortest infinite loop!

The point of this challenge is to create an infinite loop producing no output, unlike its possible duplicate. The reason to this is because the code might be shorter if no output is given.

Rules

  • Each submission must be a full program.
  • You must create the shortest infinite loop.
  • Even if your program runs out of memory eventually, it is still accepted as long as it is running the whole time from the start to when it runs out of memory. Also when it runs out of memory, it should still not print anything to STDERR.
  • The program must take no input (however, reading from a file is allowed), and should not print anything to STDOUT. Output to a file is also forbidden.
  • The program must not write anything to STDERR.
  • Feel free to use a language (or language version) even if it's newer than this challenge. -Note that there must be an interpreter so the submission can be tested. It is allowed (and even encouraged) to write this interpreter yourself for a previously unimplemented language. :D
  • Submissions are scored in bytes, in an appropriate (pre-existing) encoding, usually (but not necessarily) UTF-8. Some languages, like Folders, are a bit tricky to score - if in doubt, please ask on Meta.
  • This is not about finding the language with the shortest infinite loop program. This is about finding the shortest infinite loop program in every language. Therefore, I will not accept an answer.
  • If your language of choice is a trivial variant of another (potentially more popular) language which already has an answer (think BASIC or SQL dialects, Unix shells or trivial Brainf**k-derivatives like Alphuck), consider adding a note to the existing answer that the same or a very similar solution is also the shortest in the other language.
  • There should be a website such as Wikipedia, Esolangs, or GitHub for the language. For example, if the language is CJam, then one could link to the site in the header like #[CJam](http://sourceforge.net/p/cjam/wiki/Home/), X bytes.
  • Standard loopholes are not allowed.

(I have taken some of these rules from Martin Büttner's "Hello World" challenge)


Please feel free to post in the comments to tell me how this challenge could be improved.

Catalogue

This is a Stack Snippet which generates both an alphabetical catalogue of the used languages, and an overall leaderboard. To make sure your answer shows up, please start it with this Markdown header:

# Language name, X bytes

Obviously replacing Language name and X bytes with the proper items. If you want to link to the languages' website, use this template, as posted above:

#[Language name](http://link.to/the/language), X bytes

Now, finally, here's the snippet: (Try pressing "Full page" for a better view.)

var QUESTION_ID=59347;var ANSWER_FILTER="!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe";var COMMENT_FILTER="!)Q2B_A2kjfAiU78X(md6BoYk";var OVERRIDE_USER=41805;var answers=[],answers_hash,answer_ids,answer_page=1,more_answers=true,comment_page;function answersUrl(index){return"//api.stackexchange.com/2.2/questions/"+QUESTION_ID+"/answers?page="+index+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+ANSWER_FILTER}function commentUrl(index,answers){return"//api.stackexchange.com/2.2/answers/"+answers.join(';')+"/comments?page="+index+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+COMMENT_FILTER}function getAnswers(){jQuery.ajax({url:answersUrl(answer_page++),method:"get",dataType:"jsonp",crossDomain:true,success:function(data){answers.push.apply(answers,data.items);answers_hash=[];answer_ids=[];data.items.forEach(function(a){a.comments=[];var id=+a.share_link.match(/\d+/);answer_ids.push(id);answers_hash[id]=a});if(!data.has_more)more_answers=false;comment_page=1;getComments()}})}function getComments(){jQuery.ajax({url:commentUrl(comment_page++,answer_ids),method:"get",dataType:"jsonp",crossDomain:true,success:function(data){data.items.forEach(function(c){if(c.owner.user_id===OVERRIDE_USER)answers_hash[c.post_id].comments.push(c)});if(data.has_more)getComments();else if(more_answers)getAnswers();else process()}})}getAnswers();var SCORE_REG=/<h\d>\s*([^\n,<]*(?:<(?:[^\n>]*>[^\n<]*<\/[^\n>]*>)[^\n,<]*)*),.*?(\d+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/;var OVERRIDE_REG=/^Override\s*header:\s*/i;function getAuthorName(a){return a.owner.display_name}function process(){var valid=[];answers.forEach(function(a){var body=a.body;a.comments.forEach(function(c){if(OVERRIDE_REG.test(c.body))body='<h1>'+c.body.replace(OVERRIDE_REG,'')+'</h1>'});var match=body.match(SCORE_REG);if(match)valid.push({user:getAuthorName(a),size:+match[2],language:match[1],link:a.share_link,});else console.log(body)});valid.sort(function(a,b){var aB=a.size,bB=b.size;return aB-bB});var languages={};var place=1;var lastSize=null;var lastPlace=1;valid.forEach(function(a){if(a.size!=lastSize)lastPlace=place;lastSize=a.size;++place;var answer=jQuery("#answer-template").html();answer=answer.replace("{{PLACE}}",lastPlace+".").replace("{{NAME}}",a.user).replace("{{LANGUAGE}}",a.language).replace("{{SIZE}}",a.size).replace("{{LINK}}",a.link);answer=jQuery(answer);jQuery("#answers").append(answer);var lang=a.language;lang=jQuery('<a>'+lang+'</a>').text();languages[lang]=languages[lang]||{lang:a.language,lang_raw:lang,user:a.user,size:a.size,link:a.link}});var langs=[];for(var lang in languages)if(languages.hasOwnProperty(lang))langs.push(languages[lang]);langs.sort(function(a,b){if(a.lang_raw.toLowerCase()>b.lang_raw.toLowerCase())return 1;if(a.lang_raw.toLowerCase()<b.lang_raw.toLowerCase())return-1;return 0});for(var i=0;i<langs.length;++i){var language=jQuery("#language-template").html();var lang=langs[i];language=language.replace("{{LANGUAGE}}",lang.lang).replace("{{NAME}}",lang.user).replace("{{SIZE}}",lang.size).replace("{{LINK}}",lang.link);language=jQuery(language);jQuery("#languages").append(language)}}
body{text-align:left!important}#answer-list{padding:10px;width:500px;float:left}#language-list{padding:10px;padding-right:40px;width:500px;float:left}table thead{font-weight:700}table td{padding:5px}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b"> <div id="language-list"> <h2>Shortest Solution by Language</h2> <table class="language-list"> <thead> <tr><td>Language</td><td>User</td><td>Score</td></tr> </thead> <tbody id="languages"> </tbody> </table> </div> <div id="answer-list"> <h2>Leaderboard</h2> <table class="answer-list"> <thead> <tr><td></td><td>Author</td><td>Language</td><td>Size</td></tr> </thead> <tbody id="answers"> </tbody> </table> </div> <table style="display: none"> <tbody id="answer-template"> <tr><td>{{PLACE}}</td><td>{{NAME}}</td><td>{{LANGUAGE}}</td><td>{{SIZE}}</td><td><a href="{{LINK}}">Link</a></td></tr> </tbody> </table> <table style="display: none"> <tbody id="language-template"> <tr><td>{{LANGUAGE}}</td><td>{{NAME}}</td><td>{{SIZE}}</td><td><a href="{{LINK}}">Link</a></td></tr> </tbody> </table>

user41805

Posted 2015-10-02T17:20:15.947

Reputation: 16 320

41I've got to start posting programs with a negative byte count to beat all these empty files! – CJ Dennis – 2015-10-03T04:32:30.037

3This challenge is interesting because it brings out lots of 0 byte languages (some of which are NOT esolangs). FWIW, most declarative languages have an implicit infinite loop because declarative languages don't have loops in their syntax (they assume they're running in an infinite loop). Ladder diagrams are perhaps among the oldest such languages. Then you have the Instruction Language (IL), a sort of assembly for PLCs that also assume an infinite loop. ILs, like assembly are different between manufacturers – slebetman – 2015-10-05T09:36:50.273

Are programs that read and execute their own source code allowed, or does file I/O break the "must take no input" rule? – ThisSuitIsBlackNot – 2015-10-06T13:05:04.253

1@ThisSuitIsBlackNot Yes, file input is allowed. – user41805 – 2015-10-06T16:47:01.750

Can you print "", an empty string? – OldBunny2800 – 2016-03-07T23:39:09.760

Most C compilers create a temporary file to avoid torturing the memory when resolving preprocessor directives. Does it make this answer non-competing because it throws the compiler itself in an infinite loop using a recursive #inclusion?

– user8397947 – 2016-05-29T15:57:32.987

Btw, here's a general note: Open the links on the leaderboard on a new tab/window. – user8397947 – 2016-05-29T15:59:35.323

@OldBunny2800 No, you can't – user41805 – 2016-11-12T07:45:03.903

@KritixiLithos Do you mean, no trailing newline, right? Because just printing an empty string without a trailing newline is no output at all. – Erik the Outgolfer – 2016-11-12T10:19:18.537

@EriktheGolfer As weird as it sounds, not even an empty string "" should be outputted. – user41805 – 2016-11-12T10:22:42.600

@KritixiLithos I mean, without the quotes and trailing newlines. Of course " can't be in the output. – Erik the Outgolfer – 2016-11-12T10:24:19.820

@EriktheGolfer I also mean without the quotes and without trailing newlines. – user41805 – 2016-11-12T10:25:15.953

@KritixiLithos Oh... gosh. So, let's say that you can't use print(end='') in Python 3, for example. I think this is really weird, but I'll adhere to the rule. – Erik the Outgolfer – 2016-11-12T10:29:15.903

Answers

215

Befunge, 0 bytes



Yup. A Befunge program exists in a two-dimensional playfield with fixed size which wraps around the edges. With nothing in that space to interfere, the program counter runs in an infinite loop by default :)

daniero

Posted 2015-10-02T17:20:15.947

Reputation: 17 193

10Aw, I was gonna post this. :/ – Deusovi – 2015-10-02T18:00:59.730

5

@daniero It may have some relation to this standard loophole.... I personally don't agree with the standard loophole.

– Justin – 2015-10-02T20:02:11.237

17@Justin That loophole only applies to certain types of challenges. – Dennis – 2015-10-02T20:32:20.023

1You can use <pre>&nbsp;</pre> for an empty-looking code block. – user253751 – 2015-10-03T06:17:03.893

First thing I looked for – Dylan Madisetti – 2015-10-12T05:20:04.150

152

L00P, 0 bytes



This lang was made for looping, and that's just what it'll do...

Dennis

Posted 2015-10-02T17:20:15.947

Reputation: 196 637

15LOL. +1 for choice of language. – ETHproductions – 2015-10-02T18:29:08.510

76... one of these days this lang is gonna loop all over you – Pål GD – 2015-10-03T11:05:16.530

3+1 for the musical reference, and congrats on another gold badge! – Luis Mendo – 2016-07-01T23:35:40.240

The best reference I have seen – Christopher – 2017-07-20T16:44:54.143

139

C64 Machine Code, 2 Bytes

D0 FE

Branches to itself if the zero flag is not set.

Branches are single-byte offsets from the next instruction location, and 254 is -2 in two's complement... the BNE instruction (D0) takes one byte of memory, and the offset takes a second byte, so branching two bytes back branches back to itself. The zero flag is always cleared when code is loaded into memory.

Note that this is not a recursive subroutine call, so you will never run out of memory. Also note that there is no header, compiler, or executable overhead... it is truly a two-byte program :)

James King

Posted 2015-10-02T17:20:15.947

Reputation: 1 491

Or EB FE for the unconditional jump – user45891 – 2015-10-02T19:47:24.957

13Shouldn't this work on any machine with a 6502 / 6510 family processor, not just a C64? Also, what you've written is machine code. The assembly would be BNE -2 – Level River St – 2015-10-02T19:54:39.343

55+1 for making an actual program that is small, instead of trying to find the most obscure language that just so happens to have the least characters to represent the structure. – Knetic – 2015-10-02T20:40:37.043

1@user45891 EB FE is x86. 6502/6510 doesn't have an unconditional short jump instruction. – Random832 – 2015-10-02T22:21:57.180

Ya, what Random832 said... I had thought there might be an unconditional branch, but when I checked my (old, old, cracked-plastic-binder) reference manual, there was not. EB was "reserved for future expansion", though, so maybe that was added in to a later version of the chip. – James King – 2015-10-03T17:18:58.430

2Steveverrill, touché, it is machine code, indeed. And yes, I thought more people would recognize the Commodore 64 than the 65xx family in general :) The VIC-20 used the 6502 and would have been able to run this. So, technically, would my 1541 floppy drive... I vaguely recall being able to reprogram the controller on that. Ah, I still miss my C64 :) – James King – 2015-10-03T17:32:33.040

It wasn't showing up, thought maybe I misunderstood what I was supposed to do with that snippet :) Already removed, and I'm showing up now... though the format of the results is terrible in both fx and ie – James King – 2015-10-03T19:16:16.460

It takes a minute after it's submitted to show up/update. I've changed the formatting slightly; hopefully it's better now. Also, if you want to have an actual strikethrough through the word "Assembly", you can just use <s>Assembly</s>. – ETHproductions – 2015-10-03T20:54:22.223

1

@Random832: Actually some of the later 6502 descendants did have an unconditional branch instruction (BRA, 0x80) - see for example this page (search for "BRA").

– psmears – 2015-10-05T20:15:30.523

@steveverrill This is machine code for any 6502 machine that guarantees carry is clear at program start. The C64 OS specifies this, but machines that leave this unspecified need an additional CLC opcode ($18) at start for a 1-byte penalty. – Damian Yerrick – 2015-10-07T13:10:41.590

8Back in the day, a particularly nasty "trick" (imho vandalism) that customers would play on unsuspecting computer store owners was to place two bytes akin to this but for the X86, at the beginning of the bootloader, using DOS' debug. This would effectively brick the machine, and most shop staff lacked the nous to know it wasn't just a dead drive. – Dewi Morgan – 2015-10-11T06:56:44.017

107

Brainfuck, 3 bytes

+[]

Never decrement: never end.

mınxomaτ

Posted 2015-10-02T17:20:15.947

Reputation: 7 398

65It's funny when BF beats most other answers. – Rohcana – 2015-10-03T15:24:02.127

I had to think of this when I saw the question on SE's start page. – s3lph – 2015-10-03T16:03:25.620

1My first thought was BF! :D It ended shorter than I thought. – André Christoffer Andersen – 2015-10-03T19:16:48.623

1Alternative, still same bytes: -[] – Unihedron – 2018-01-19T01:08:27.427

2I bet there's an interpreter somewhere where ] would work – 12Me21 – 2019-03-25T21:55:19.580

@12Me21 The most recent one I wrote, I just realized. – Khuldraeseth na'Barya – 2019-08-07T17:52:34.453

103

///, 3 bytes

///

Any bonus points for using the language's name as source code?

Dennis

Posted 2015-10-02T17:20:15.947

Reputation: 196 637

72I'm honestly surprised that the link actually works, seeing as how it ends with /// ;) – ETHproductions – 2015-10-04T01:11:29.030

1@ETHproductions That is rather surprising, but if one thinks about it a bit more, it makes some sense; it's just the URL esolangs.org wiki _ _ _ _ – HyperNeutrino – 2016-05-01T22:33:39.853

13@AlexL. Not entirely. The web server sees a GET request to /wiki////. While that intended to be a path, the server can do with that information whatever it wants. – Dennis – 2016-05-02T00:54:26.530

73

Java, 53 bytes

class A{public static void main(String[]a){for(;;);}}

Yay full program requirement!

Geobits

Posted 2015-10-02T17:20:15.947

Reputation: 19 061

79God is that verbose... – mınxomaτ – 2015-10-02T17:29:22.753

2Aah, I when I received a notification saying that someone posted a Java answer, I guessed the person to be you! – user41805 – 2015-10-02T17:29:56.193

4@minxomat Yep, 45 bytes for an empty main :( – Geobits – 2015-10-02T17:30:40.933

3@minxomat gotta love that OOP – Luke – 2015-10-06T15:39:34.907

There was a time you could abuse an enum for that - the complaint about the missing main method would occur only after instantiation - but Java 8 checks this now beforehand. That's very sad for code golf. – Landei – 2015-10-07T08:13:46.483

@Landei Java 7 won't let you either; I think 6 was the last. Either way, I believe that prints to stderr when run, so it wouldn't be valid here. – Geobits – 2015-10-07T12:48:13.457

1@Geobits: It would write the error after the loop - so in our case never... – Landei – 2015-10-07T12:51:50.720

58That ain't OO. Putting code in a class doesn't make it OO any more than putting a rock in the microwave makes it food. – imallett – 2015-10-11T05:18:52.997

5

@imallett Who says rocks aren't food?

– Geobits – 2015-11-16T01:36:12.540

@Geobits that guy died tragically, remember? – imallett – 2015-11-16T04:11:33.850

Why not using a static block? Works normally... – Mega Man – 2016-07-23T18:52:15.307

3Replace class with interface and drop the public. Also, call main recursively instead of making a loop. – Pavel – 2017-01-08T10:23:35.287

@Phoenix main(a); == for(;;); – Magic Octopus Urn – 2017-06-06T14:42:37.600

Wouldn't calling it recursively overflow itself and write to STDERR anyway? I assumed this was not allowed. I haven't tried, so maybe it optimizes it away, but if it's no shorter I won't bother. – Geobits – 2017-06-07T14:50:17.697

56

Prolog, 5 bytes

a:-a.

In order to know if predicate a is true, you only need to check if predicate a is true.

You need to load the file and execute a, both with a command-line arguments. Note that the recursion is likely to be optimized as an infinite loop and shouldn't blow the stack.

Also, this looks like a smiley, but I am not sure how to call it. The dot looks like saliva, so maybe "vegetative state", or "Infiurated programmer with curly hair". Suggestions are welcome.

coredump

Posted 2015-10-02T17:20:15.947

Reputation: 6 292

3Check if a is true by checking if a is true by checking if a is true by checking...yay recursion! – kirbyfan64sos – 2015-10-08T20:20:20.510

51

Haskell, 9 bytes

Infinite recursion of the main function. Should get compiled to a loop due to tail recursion optimization.

main=main

Grant

Posted 2015-10-02T17:20:15.947

Reputation: 511

1It compiles, but if run the runtime system detects the loop and throws the <<loop>> exception - at least with ghc. Maybe some other compiler behaves differently. – nimi – 2015-10-03T10:23:12.520

4Doing runhaskell Loop.hs happily executed it for several minutes on my machine. So, it's at least runnable by an interpreter. I think the <<loop>> runtime exception that ghc throws is purely an implementation detail of the runtime and not part of the Haskell language as specified in any of the Haskell Reports. – GrantS – 2015-10-03T17:29:09.670

It's an edge case. runhaskell happily accepts the code but it doesn't loop. It does nothing. However, the challange only requires to create the loop, not to execute it, so I guess it's fine. Have a +1. – nimi – 2015-10-04T14:45:56.060

@GrantS: the Haskell language has no such notion as a “loop”; definitions like main = main are semantically in the same bucket as undefined or error "<<loop>>": bottom values ⟂. – ceased to turn counterclockwis – 2015-10-09T18:52:20.733

1I think the shortest working haskell loop would be: main=main>>main – lovasoa – 2016-11-12T14:58:52.513

@nimi, what do you mean by "it doesn't loop"? It'll run forever with no output. – dfeuer – 2019-03-23T07:04:22.230

@dfeuer: if you start the program with runhaskell, yes, it does not terminate but it also uses no cpu time, so it does nothing. Running through a (empty) loop would require at least some cpu activity. – nimi – 2019-03-23T09:49:35.973

@nimi, ah, I see what you mean. I wonder what Hugs does with it. – dfeuer – 2019-03-23T10:29:14.350

43

Python, 9 bytes

Works in both 2 and 3.

while 1:0

Shortened by @FryAmTheEggman

Ruth Franklin

Posted 2015-10-02T17:20:15.947

Reputation: 760

note, this does produce output when ran in the Python interpreter – Chris_Rands – 2017-08-08T15:16:10.390

3@Chris_Rands Only in the REPL. – HyperNeutrino – 2017-10-12T14:24:33.390

40

x86 ELF executable, 45 bytes

Unlike the vast majority of these answers, this is a truly complete program, as in a free-standing executable program.

00000000: 7f45 4c46 0100 0000 0000 0000 0000 0100  .ELF............
00000010: 0200 0300 2000 0100 2000 0100 0400 0000  .... ... .......
00000020: ebfe 31c0 40cd 8000 3400 2000 01         ..1.@...4. ..

The guts of the program are at byte 0x20 ebfe, which is featured in another answer as the smallest NASM program. If you assemble that with NASM however, you get an executable with thousands of un-needed bytes. We can get rid of most of them using the technique outlined here. You may note that this program isn't even as big as the ELF header! This bit of executable golfing malforms the ELF header and program header so they can occupy the same bytes in the file and inserts our program into some unused bytes within the header. Linux will still happily read the header and start execution at offset 0x20 where it spins forever.

casey

Posted 2015-10-02T17:20:15.947

Reputation: 551

9.com on DOS would be much shorter :) – JimmyB – 2015-10-05T11:38:00.330

1You only get "thousands" of bytes if you let gcc include the startup files. yasm && ld makes executables only about 1k. – Peter Cordes – 2015-10-05T19:58:15.600

37

INTERCAL, 42 18 bytes

(1)DO COME FROM(1)

Idea taken from @flawr's comment.

EDIT: Holy crap, INTERCAL is actually shorter than C#. I don't know if that's ever happened before...

42-byte version

DO(1)NEXT
(1)DO FORGET #1
PLEASE DO(1)NEXT

kirbyfan64sos

Posted 2015-10-02T17:20:15.947

Reputation: 8 730

12How dare you do a intercal program without comefrom – flawr – 2015-10-02T20:17:59.683

1@flawr Fixed. ;) – kirbyfan64sos – 2015-10-02T20:27:13.640

4Np, I think we need more Intercal in golfing contests here=) – flawr – 2015-10-02T20:50:31.017

17Did you say PLEASE? – Daniel M. – 2015-10-02T22:39:16.387

34

Perl, 6 bytes

perl -e '{redo}'

From perldoc -f redo:

The redo command restarts the loop block without evaluating the conditional again...Note that a block by itself is semantically identical to a loop that executes once. Thus redo inside such a block will effectively turn it into a looping construct.

I don't see redo too often in production code, but it's great for golf! Compare the above to the shortest equivalents with for, while, and goto:

for(;;){} # 9 bytes
1while 1  # 8 bytes
X:goto X  # 8 bytes

ThisSuitIsBlackNot

Posted 2015-10-02T17:20:15.947

Reputation: 1 050

1http://codegolf.stackexchange.com/a/59553/30206 suggests the 4-byte do$0, which doesn't work as a perl -e one-liner. – Peter Cordes – 2015-10-06T00:51:30.427

@PeterCordes Neat, although I think that breaks the "must take no input" rule. do EXPR reads from a file.

– ThisSuitIsBlackNot – 2015-10-06T03:35:30.983

1

@PeterCordes The OP has ruled that file I/O is acceptable. All hail the king of infinite loops in Perl!

– ThisSuitIsBlackNot – 2015-10-06T17:09:31.373

32

><>, 1 byte

 

A single space will cause ><> to go into an infinite loop of NOPs

Other valid single character programs (with no memory requirements) are as follows:

>^v</\|_#x!"'{}r

In addition, the rules state that your program can run out of memory in which case we can add the following characters to the list of valid 1-byte programs:

01234567890abcdefli

Fongoid

Posted 2015-10-02T17:20:15.947

Reputation: 971

11Try \ `` for the code block. – TheNumberOne – 2015-10-02T17:48:13.347

2Why not just use >? – mbomb007 – 2015-10-02T20:55:23.793

4If this were Chem.SE, I would recommend putting the code in MathJax, too. – hBy2Py – 2015-10-05T01:56:01.300

Are we sure an empty program wouldn't be an infinite loop? – Aaron – 2015-10-05T09:12:39.227

@AaronGOUZIT It's not empty if it has an instruction – corsiKa – 2015-10-05T22:16:45.027

@corsiKa sorry I wasn't very clear, I was suggesting that the empty program might be a valid loop in ><> – Aaron – 2015-10-06T04:49:26.317

1Get a runtime error trying to execute the empty program: Traceback (most recent call last): File "fish.py", line 493, in <module> instr = interpreter.move() File "fish.py", line 149, in move if self._position[1] > max(self._codebox.keys()): ValueError: max() arg is an empty sequence – Fongoid – 2015-10-06T17:40:03.717

Characters that would also work: >^v</\|_#x! – DanTheMan – 2015-10-08T17:45:52.310

30

LOLCODE, 24 bytes

IM IN YR X
IM OUTTA YR X

daniero

Posted 2015-10-02T17:20:15.947

Reputation: 17 193

3In many LOLCODE interpreters, such as the one on repl.it, HAI and KTHXBYE are unnecessary. – Alex A. – 2015-10-02T19:27:34.163

1@AlexA. oh, didn't know that. Thanks. – daniero – 2015-10-02T19:29:29.420

30

Motorola MC14500B Machine Code, 0.5 0 bytes



Explanation

According to the manual, the system is configured to have a looping control structure. The program counter counts up to its highest value, wraps back around to zero, and counts up again.

Zach Gates

Posted 2015-10-02T17:20:15.947

Reputation: 6 152

3I believe you have found the ultimate golfing language, at least for small tasks...not even Pyth can get this short. +1 – ETHproductions – 2015-11-04T18:02:20.593

Be warned that this shows up as 5 bytes on the scoreboard. – Addison Crump – 2015-11-18T10:31:10.600

C is Jump, but where to jump? – Kishan Kumar – 2016-10-04T04:34:06.303

3Wow, you really like this language, huh? :P – MD XF – 2017-06-11T00:26:00.150

1This will work in any machine language where 0 is a NOP, the instruction pointer wraps around, and the program memory doesn't hold any extra data. – 12Me21 – 2017-10-24T17:29:02.370

29

C, 15 bytes

main(){main();}

Yes, it's possible to call main() recursively. If you've got a compiler that does tail-call optimization (say, gcc with the -O2 option), it doesn't even segfault: the compiler is smart enough to turn the function call into a goto.

Mark

Posted 2015-10-02T17:20:15.947

Reputation: 2 099

4Unless you can give me a compiler that does this by default, you would have to add 3 bytes for the -O2 option. – LegionMammal978 – 2015-10-03T00:17:38.850

19@LegionMammal978, according to the rules in the challenge, running out of memory is acceptable. That makes the -O2 optimization a "nice-to-have" rather than a requirement. – Mark – 2015-10-03T04:22:53.093

1If options to the compiler is allowed (and is not counted for the solution count), so why not change the code to l(){l();} and compile it with the options -Dl=main -O2 – wendelbsilva – 2015-10-05T21:01:56.313

1For comparison, the shortest non-recursive proper loop implementation is 16B: main(){for(;;);}. – Peter Cordes – 2015-10-06T21:30:47.213

3@wendelbsilva you may nail it even more by changing the code to X (just one byte) and compiling with -DX=main(){main();} – LeFauve – 2015-10-07T12:37:29.227

Could you use compiler opts to rename main() to be something shorter? Further to Peter's comment, you could also use main(){while(1);} – John U – 2015-10-08T11:37:41.397

1@Mark However, it still prints the segfault message at the end. – LegionMammal978 – 2016-02-16T16:32:11.383

1Gives a segfault even with -O2. Using GCC 5.2.1 – nsane – 2016-10-04T09:18:40.250

26

Labyrinth, 1 byte

"

A labrinth program executes the same instruction over and over again if there are no neighbors. They also won't end until they execute the @ instruction.

TheNumberOne

Posted 2015-10-02T17:20:15.947

Reputation: 10 855

25

Vim, 7 keystrokes

Open the editor, preferably without any loaded scripts, for instance like like this from the command line: vim -u NONE

qq@qq@q

Vimscript, 15 8 bytes

Add it in a script, or run it directly by punching the colon (:) key first while you're in normal mode

wh1|endw

daniero

Posted 2015-10-02T17:20:15.947

Reputation: 17 193

1Your vimscript is a little long wh1|endw – FDinoff – 2015-10-06T04:48:20.000

Could you explain how this works to someone who's not familiar with Vim? – iFreilicht – 2015-10-16T11:37:18.853

8@iFreilicht qq starts recording into the q buffer. @q replays what's in the q buffer (at this point, nothing). q stops recording, and then @q replays whats in the q buffer, which at this point is the keystrokes @q. So @q replays @q replays @q.... also, writing this many q's makes my brain hurt. – Wayne Werner – 2015-12-28T17:04:40.580

25

Retina, 3 bytes

+`0

If given a single file, Retina uses a Count stage, replacing the input with the number of matches found for the given regex. Here, the regex is 0. Now + loops the stage for as long as the result changes from the previous iteration. So what exactly is happening?

  • 0 is matched against the empty input, giving zero matches, so the result is 0. This is different from the input, so we run this again.
  • 0 is matched against the previous output 0, which now gives one match... so the result is 1.
  • 0 is matched against the previous output 1, which fails... so the result is 0.
  • ... you get the idea.

The result of the loop iteration alternates between 0 and 1, which a) ensures that the loop never terminates and b) ensures that we're not running out of memory because the string doesn't grow.

By default, Retina only outputs once the program terminates, so this doesn't print anything (you can change this behaviour by adding a > after the +, which will then print the alternating zeroes and ones).

As of 1.0, Retina actually also has more traditional while-loops, which you could use with a simpler stage (which doesn't change the string all the time), but they actually require more bytes. One option would be:

//+`

Martin Ender

Posted 2015-10-02T17:20:15.947

Reputation: 184 808

1

Wow, I just answered almost the exact thing in rs at the exact same time.

– kirbyfan64sos – 2015-10-02T19:12:55.350

1@kirbyfan64sos They look very similar, but they actually work quite differently. :) – Martin Ender – 2015-10-02T19:13:56.947

Nice job. I was going to try doing the shortest Retina program in Replace mode. I'm curious, can `+`` match empty input repeatedly? – mbomb007 – 2015-10-02T21:10:36.250

@mbomb007 I think that would terminate with a 2 after a few iterations. – Martin Ender – 2015-10-03T05:34:39.400

25

BASIC (QBasic 4.5), 10 5 3 bytes

In the BASIC programming language, RUN is used to start program execution from direct mode, or to start a overlay program from a loader program. - Wikipedia

Edit: This works without a line number in QBasic 4.5, according to @steenbergh

RUN

Here's the first version I posted. Infinite GOTO loop. Also, it's 10 bytes, which is a nice coincidence!

10 GOTO 10

mbomb007

Posted 2015-10-02T17:20:15.947

Reputation: 21 944

13Why line number 10? Why not 9? – recursive – 2015-10-03T00:01:45.007

25or 8 for 8 bytes?:) – MickyT – 2015-10-03T00:04:30.470

3It's not going to win and it's funnier this way. – CJ Dennis – 2015-10-03T04:29:03.477

3This could be shorted to: 1 RUN – TOOGAM – 2015-10-03T12:43:43.003

1@mbomb007 I would like it to be changed, it is code-golf, not code-funny, :) – user41805 – 2015-10-04T07:49:43.507

Gagh. Beat me to it. ++ – RubberDuck – 2015-10-05T22:12:54.097

In C64's basic, you could write this as 1rU (3 bytes) – LeFauve – 2015-10-07T12:32:55.197

1

Using Sinclair basic this would use less bytes as the commands RUN and GO TO are both 1 byte https://en.wikipedia.org/wiki/Sinclair_BASIC

– davidjwest – 2015-10-08T15:23:09.907

@davidjwest I think the different dialects of BASIC are often different enough to be separate. There are too many. Like how TI-BASIC is usually separate. – mbomb007 – 2015-10-08T16:07:25.517

2@davidjwest Shortest I can do in Sinclair BASIC is: 1 GOTO SIGNUM PI - since constant ints are stored in memory twice, as shorts, so 1 would be 4 bytes, but SIGNUM and PI both use only one byte each. Ah, the old coding tricks we used to use :D Not sure how much memory line numbers take up, if any, so all I can say is it's 3+(line number storage) bytes. – Dewi Morgan – 2015-10-11T07:06:22.040

1In QBasic 4.5, just using RUN (without the line numbers) works just as well, so 3 bytes? – steenbergh – 2015-12-26T09:48:28.020

1@DewiMorgan 1 RUN also works in Sinclair BASIC for 6 bytes (2 bytes line number + 2 bytes line length + 1 byte for RUN token + 1 byte for newline). – Neil – 2016-01-14T00:46:10.247

1@Neil RUN! Hah - nice. :D – Dewi Morgan – 2016-01-14T01:12:13.580

23

TIS Node Type T21 Architecture, 6 bytes

A single node with NOP written in it

Tessellated Intelligence System nodes are classified as "processing" or "storage" nodes. Storage nodes simply store and retrieve information, and are irrelevant in this case. Remaining are the processing nodes. Node Type T21, or Basic Execution Node, is the most common and simple (as the name would suggest).

Technically, each node can be thought of as an independent computer. In the case of the T21, it is a computer that has two storage registers (one addressable, one not) and an instruction set of 15 commands. It has enough memory to be programmed with up to 15 instructions. All TIS nodes have four ports connecting them to the topologically adjacent nodes. Reading from a port causes that node to hang until the node on the other end writes to it, and writing to a port hangs until that node reads it.

You might be able to tell by now that TIS nodes were never meant to do much on their own. Together, though, they can be quite powerful... well, for their time. Because of these limitations, it's very rare to see someone use only a single node. In fact, a program that takes input and provides output based on it must use at least three nodes, as TIS systems feed input into the UP port of a node on the top row and take output from the DOWN port of a node on the bottom row. There are three rows, so data must pass through at least three nodes to get to the bottom.

Because of these limitations, TIS nodes are intended to generally be used somewhat like this:

  1. Get input
  2. Do something to it
  3. Pass it on
  4. Return to step 1

Because of this, the limited space for instructions and the fact that nodes simply wait quietly and don't cause trouble when trying to read input that isn't there, a decision was made in their design that makes them very good for this challenge. I'll quote from the TIS-100's reference manual:

After executing the last instruction of the program, execution automatically continues to the first instruction.

Perfect! Infinite loops are default for TIS nodes.

I very nearly answered this question with a 0 byte answer, claiming that an empty node was an infinite loop. However, I researched further. First, the quote above states that the loop occurs after executing the last instruction. Additionally, I tested the implementation. Each node reports a "mode" at all times. It isn't accessible programmatically but it's intended to make debugging easier. Here are the possible modes:

 RUN‌ - I am executing an instruction.
READ - I am reading from a port, waiting for it to be written to.
WRTE - I am writing to a port, waiting for it to be read from.
IDLE - I am doing nothing.

It turns out that, since each node is an individual computer, they are capable of determining whether or not they have instructions to execute. If not, they remain in the IDLE state (likely to save power). As such, I couldn't in good conscience claim that it was "looping"; rather, each node sat quietly, assuming the others were doing something important.

This program that I've submitted is truly an infinite loop, as executing it sets the state of the node to RUN. It is as simple as you would expect, NOP performs No OPeration. Once it's done doing nothing, execution returns to the top of the code: NOP.

If you find it unsatisfying that I'm abusing the T21 architecture to create a loop, I offer an alternate solution at the cost of 2 bytes: JRO 0. JRO means Jump Relative uncOnditionally. Or something, I guess. There's no agreed-upon expanded form of the instructions. Anyway, JRO takes a numeric argument and jumps execution by that amount relative to the current position. For example, JRO 2 skips the instruction that follows it (useful if that instruction is jumped to from somewhere else). JRO 1 jumps forward one instruction, making it a NOP. JRO -1 jumps back one instruction, effectively performing the previous instruction once every two cycles until the program is halted. And, of course, JRO 0 jumps to itself, executing itself forever.

At this point you may be thinking:

Sure, monorail, this all makes sense, but your answer is simply NOP. Why is its score 6 bytes?

Good question, thanks for asking. One may naively think that TIS programs should be counted the same way we count programs in multiple files: the number of bytes in all nodes, plus 1 byte for each additional node after the first. However, the TIS golfing community decided this would be unfair for the simple reason that it ignores some of the information required to recreate solutions. A node's neighbours are very important, and that scoring method gives you positional information for free. Instead, we've adopted the format used by the most common TIS emulator, the confusingly-named TIS-100. (Side note: Please don't name emulators after the system they emulate. It's not clever, it's just annoying and makes everyone have to constantly clarify what they're talking about.) It's very simple: The 12 nodes of a TIS-100 device are numbered, left to right and top to bottom, skipping any storage nodes the emulated system has installed. A node numbered N containing # CODE\n# CODE\n CODE is saved like so:

@N
# CODE
# CODE
# CODE

And so, a node numbered 0 containing NOP is scored according to its representation in this format:

@0
NOP

Six bytes.

As I often include in my answers in visually-interesting languages, you can watch the TIS-100 emulator execute this program on YouTube. Though, considering what this challenge is, I don't know what you expect to see...

undergroundmonorail

Posted 2015-10-02T17:20:15.947

Reputation: 5 897

Wow-ee. That was amazing. – Adrian Zhang – 2017-10-27T02:02:45.700

I always assumed JRO stood for Jump to Relative Offset. – MutantOctopus – 2018-01-23T12:52:46.833

@BHustus i think you're right but i wrote this before i had experience with any other assembly language and i didn't know the lingo – undergroundmonorail – 2018-01-23T12:56:42.253

I wish I could +10 this answer. I love TIS-100 – Shirkam – 2018-03-02T12:49:13.460

I wrote a TIS emulator of my own, so you can now Try It Online. Don't expect much other than a timeout, though.

– Phlarx – 2018-03-29T21:36:19.303

Are you sure the emulator included in the game TIS-100 is called TIS-100? I didn't realize it had a name...

– SamB – 2018-09-21T21:01:05.737

Hmm, so I guess the reason you need to write code is that if you don't, all of the nodes will just be IDLE forever? – SamB – 2018-09-21T21:29:19.540

Hmm, I see you leave out a lot of stuff that the game's emulator would include, such as entries for empty nodes (including the blank lines between nodes AND at least a blank of code for each node) and the newline at the end of the last line of code, but the game's emulator is perfectly happy to load such a file, so: good thinking! – SamB – 2018-09-21T22:30:15.377

22

C#, 38 37 36 bytes

class B{static int Main(){for(;;);}}

For loop with no stopping condition.

The return of main should be an int, but since it'll never reach the end this should compile. (Tested in VS 2015 and 2013, also works in Ideone). Thanks Geobits and MichaelS.

A shorter version, 35 bytes, can be achieved, but prints Process is terminated due to StackOverflowException which I believe violates the third point of not printing anything to stderr. Credit to MichaelB

class B{static int Main()=>Main();}

Sven Writes Code

Posted 2015-10-02T17:20:15.947

Reputation: 974

1Can you save one by using ; instead of {}? I'd test, but online services don't like infinite loops much. – Geobits – 2015-10-02T17:44:32.153

@Geobits Ah, yes. How such simple things slip by. – Sven Writes Code – 2015-10-02T17:52:38.040

1It may depend on compiler, but I saved another character by declaring it as int main and it ran without a return statement. I'm using Microsoft Visual C# 2013 Community Version 12.0.31101.00 Update 4. "class A{static int Main(){for(;;);}}" – MichaelS – 2015-10-03T04:40:27.247

@MichaelS Thanks! Worked in 2015 VS for me. – Sven Writes Code – 2015-10-03T16:35:11.117

1In vs 15, this might be shorter (barely). 35 class B{static int Main()=>Main();} – Michael B – 2016-01-25T20:28:33.150

@MichaelB That would be infinite (given infinite memory), but does it violate the third point since something is printed? I am testing using visual studio 2015 as a console application. – Sven Writes Code – 2016-01-26T03:26:38.900

Try compiling in X64. It should do tail optimization and hopefully eliminate that inf loop? – Michael B – 2016-01-26T20:12:30.947

21

Foo, 3 bytes

(1)

Everyone's favorite programming language! :D

kirbyfan64sos

Posted 2015-10-02T17:20:15.947

Reputation: 8 730

20

Hexagony, 1 byte

.

I don't know much about this awesome language created by @MartinBüttner, but from what I've seen, this should loop infinitely, as there is no @ to halt the program. . is simply a no-op.

ETHproductions

Posted 2015-10-02T17:20:15.947

Reputation: 47 880

3Why don't you test it, :D – user41805 – 2015-10-03T03:23:53.870

7I can confirm that this is correct. :) – Martin Ender – 2015-10-03T19:01:28.380

@KritixiLithos Because I couldn't find an online interpreter, and I don't prefer to download the interpreter for every language I ever want to test. ;) – ETHproductions – 2015-10-03T19:07:45.220

16

@ETHproductions You don't? Huh.

– Martin Ender – 2015-10-05T21:35:40.563

@Martin Ender: ls as an alias for dir? OMG. – Mega Man – 2016-07-23T18:54:53.603

@MegaMan I believe that works out of the box in PowerShell. – Martin Ender – 2016-07-23T20:07:11.330

@MartinEnder: Hm. I don't use it, I don't like MS – Mega Man – 2016-07-24T17:27:25.580

1

TIO shows that an empty program works.

– Weijun Zhou – 2018-03-02T09:02:50.257

20

Perl, 4 bytes

do$0

Executes itself repeatedly.

Lynn

Posted 2015-10-02T17:20:15.947

Reputation: 55 648

1Very cool. At first I thought this violated the "must take no input" rule since do EXPR reads from a file, which would technically be input, but the OP clarified that file I/O is acceptable. The really cool thing is that unlike the equivalent in Bash, say, this doesn't fork any new processes, so it will continue indefinitely without hitting any memory or process limits. – ThisSuitIsBlackNot – 2015-10-06T16:52:47.097

18

Gammaplex, 0 bytes

In Gammaplex, it isn't possible to write a program that isn't an infinite loop. So I just write a program that doesn't use input/output.

jimmy23013

Posted 2015-10-02T17:20:15.947

Reputation: 34 042

Well the rules state that there needs to be an infinite loop to qualify. – arodebaugh – 2017-04-20T19:56:38.043

@arodebaugh There is. In other words, there is an infinite loop in every Gammaplex program. – jimmy23013 – 2017-04-20T20:12:04.757

16

Pyth, 2 bytes

# 

Pyth expects tokens after the forever operator. (That's a space.)

Blue

Posted 2015-10-02T17:20:15.947

Reputation: 26 661

16

bash + BSD coreutils, 23 22 14 6 5 6 bytes

yes>&-

yes outputs "y" forever; >&- closes STDOUT.

Thanks @Dennis and @ThisSuitIsBlackNot for help getting the size down!

Ben

Posted 2015-10-02T17:20:15.947

Reputation: 360

4With bash you can just do $0 in a shellscript and run it, it will invoke itself forever. – TessellatingHeckler – 2015-10-02T18:57:31.280

This keeps creating more processes until the system runs out of memory though, no? - it's not really an infinite loop. – Ben – 2015-10-02T19:06:08.617

1Creative, but boring old while :;do :;done is only 17 bytes. – ThisSuitIsBlackNot – 2015-10-02T19:09:18.933

@Ben so get a computer with infinite memory. ;) We're already assuming computers with eternal power supplies, hardware which is infinitely reliable, and an environment which can dissipate infinite heat; it seems a bit silly to draw a line at infinite memory and say that's a step too far. – TessellatingHeckler – 2015-10-02T19:18:56.363

@ThisSuitIsBlackNot good point! But I was determined to find a sillier answer, and I did. – Ben – 2015-10-02T19:41:26.303

3ping>&- 0 works on Linux, where 0 is mapped to localhost. – Dennis – 2015-10-02T19:46:26.043

1yes! (I thought about using yes but it didn't occur to me to discard the output.) You can save one byte with yes>/dev/null – ThisSuitIsBlackNot – 2015-10-02T19:50:19.803

Of course, since the rules only say you can't write to stdout or stderr, yes>- would also work :) – ThisSuitIsBlackNot – 2015-10-02T19:54:52.593

yes>&- will exit immediately, complaining about a bad file descriptor – Dennis – 2015-10-02T19:56:37.430

@Dennis yes>&- works for me with BSD yes but not GNU yes, but I'll change it to yes>- since that's shorter anyway. – Ben – 2015-10-02T19:59:11.887

@ThisSuitIsBlackNot what does >- do exactly? Google isn't being very helpful. – Ben – 2015-10-02T20:00:21.370

1yes>- is just a slightly-obfuscated version of yes>a. It writes to a file called -. From my reading of the rules, this is acceptable, although Dennis has since commented on the question asking for clarification, and it does seem like kind of a loophole. – ThisSuitIsBlackNot – 2015-10-02T20:00:42.763

3I wasn't aware of that. If it works with BSD yes, great, but I don't think writing to a file complies with producing no output. – Dennis – 2015-10-02T20:03:54.763

Is the title considered part of the rules? The body of the challenge only specifies not outputting to stdout or stderr. Though on second thought, this program will stop when the disk fills up, so... – Ben – 2015-10-02T20:06:04.037

I just checked, and it turns out ping isn't part of coreutils. What a drag. – Ben – 2015-10-02T20:26:30.007

@ThisSuitIsBlackNot: shorter: define and call a recursive function: f(){ f;};f. Or even shorter than that, but each recursive call creates a subprocess: f()(f);f. (i.e. something like a forkbomb, but my computer did manage to process my ^c and stop it, while the OOM killer was killing firefox, or after. I do have some swap space). See http://codegolf.stackexchange.com/a/41201/30206 for more about () function defs on the bash-golfing FAQ.

– Peter Cordes – 2015-10-06T01:12:47.303

@PeterCordes Can't test right now, but won't those segfault eventually, printing something to stderr? – ThisSuitIsBlackNot – 2015-10-06T03:44:28.807

@ThisSuitIsBlackNot: oh, yeah good point. I guess a recursive C program can get away with it, because it's not the C program itself that prints the error message. IDK if bash would catch its own segfault and print an error message, or simply exit and leave it to a parent process to get the exit status. {} version isn't tail-call optimized in bash4.3; memory usage does keep growing. – Peter Cordes – 2015-10-06T11:54:16.527

I put in a suggested-edit for yes|wc, which is also 6 chars, but portable to any yes implementation. – Peter Cordes – 2015-10-06T22:02:00.467

15

Common Lisp, 6 characters

(loop)

coredump

Posted 2015-10-02T17:20:15.947

Reputation: 6 292

44Is there something such as Rare Lisp? – flawr – 2015-10-02T20:15:31.227

11@flawr I'll assume it was just a humorous comment, but Common Lisp is the result of a standardization process that unified a bunch of mostly-but-not-quite compatible languages in the Lisp family. Languages in the Lisp-family that aren't Common Lisp include Scheme, Racket, Emacs Lisp, and Clojure. – Joshua Taylor – 2015-10-03T03:07:20.143

Also (a bit longer, but if we didn't have to count parens, it'd be just two bytes): (do()(())). – Joshua Taylor – 2015-10-03T03:08:41.653

@JoshuaTaylor I thought about do too, and about making the reader goes on infinite loop but I don't see how to do it shortly. It seems that nothing beats (loop). – coredump – 2015-10-03T12:50:44.050

@JoshuaTaylor if you didn't count parens lisp would be the golfiest language of them all – Cyoce – 2017-02-16T00:06:27.670

13

Fission, 1 byte

There are exactly 4 one-byte solutions:

R
L
U
D

These four letters indicate that an atom starts there (in the corresponding direction). One of them is required because without an atom the program terminates immediately. Since the source code is only one character in size, the atom will wrap around immediately, and execute the same cell again. However, after the beginning of the program UDLR simply act to deflect an incoming atom in the corresponding direction, so they become no-ops in this case.

Martin Ender

Posted 2015-10-02T17:20:15.947

Reputation: 184 808

12

PowerShell, 7 bytes

for(){}

...

briantist

Posted 2015-10-02T17:20:15.947

Reputation: 3 110

1Heh. Beat my own attempt by three bytes. Learned a couple of things from this challenge! – Booga Roo – 2015-10-04T20:38:43.343

1Quickly writes code. Starts scrolling to post...oh... for(){} same – Chad Baxter – 2016-10-06T14:21:27.720

11

Funciton, 72 bytes

Encoded in UTF-16.

I cannot think of a smaller Funciton program that would run forever. It consists of a declaration of a function that calls itself and a main program that calls said function on STDIN. Is it possible to do shorter?...

┌─╖╓─╖┌─╖╔╗
┤∞╟╢∞║┤∞╟╢║
╘═╝╙─╜╘═╝╚╝

Timwi

Posted 2015-10-02T17:20:15.947

Reputation: 12 158

Well, it looks like this only takes 35 bytes in cp437, and according to Python it actually round-trips. Does that count as shorter?

– SamB – 2018-09-21T22:07:51.293

1@samb The interpreter doesn't accept cp437-encoded files. – Timwi – 2018-10-10T12:14:23.617

10

Matlab/Octave, 11 bytes

while 1;end

(tested)

flawr

Posted 2015-10-02T17:20:15.947

Reputation: 40 560

It works. You can remove the untested warning. +1. – rayryeng - Reinstate Monica – 2015-10-02T22:32:31.870

Did you test it in Matlab and Octave? (Oh and I just noticed: Tested says nothing about the outcome of the test=)) – flawr – 2015-10-02T23:03:42.037

2Yes they both work... Well... It halts :) if that's what you're looking for. – rayryeng - Reinstate Monica – 2015-10-02T23:05:50.660

10

A POSIX OS's program loader, 14 bytes

#!/usr/bin/env

Steven Stewart-Gallus

Posted 2015-10-02T17:20:15.947

Reputation: 201

How do you run this? – Alex A. – 2015-10-03T00:47:04.443

The space isn't necessary. – jimmy23013 – 2015-10-03T01:46:56.107

@AlexA. Save as t, make executable (chmod +x t) and execute (./t). – Dennis – 2015-10-03T01:47:17.313

Why does this loop? – xebtl – 2015-10-05T07:20:07.553

1@xebtl: With this in /tmp/foo, the execve(/tmp/foo) -> OS invokes /usr/bin/env as the interpreter, with argv[0] = /tmp/foo. This causes env to execve(/tmp/foo). Try it with strace -f -eexecve /tmp/foo. The Linux man page for env(1) doesn't seem to mention the case where env is invoked with it's 0th arg being something other than env, but it's standard behaviour. I guess env figures out when it's being used as an interpreter for stuff like #!/usr/bin/env perl to use $PATH to find perl. So in that case, it processes anything on the line as env args, then appends $0. – Peter Cordes – 2015-10-06T00:31:35.417

1Putting #!/tmp/f in /tmp/f results in execve returning an error: ELOOP. Even if that did work, you'd have to count the string twice: once in the file, and once as the required filename. (although /f would work, and maybe even a single-char relative path). But anyway, not viable. – Peter Cordes – 2015-10-06T00:32:51.250

@PeterCordes thanks, I realize now I did not actually know how #!/usr/bin/env python works before. – xebtl – 2015-10-06T07:44:56.160

9

Recall, 2 bytes

Yy

Since there is no break operator, it will loop forever. You can try it here. Of course it will freeze the tab.

mınxomaτ

Posted 2015-10-02T17:20:15.947

Reputation: 7 398

9

GolfScript, 3 bytes

1do

For obvious reasons, this does not work in the online interpreters.

Dennis

Posted 2015-10-02T17:20:15.947

Reputation: 196 637

Shame this has got only 2 upvotes after over a year, it deserves more... – Erik the Outgolfer – 2016-11-12T10:47:16.187

9

Pyth, 2 bytes

I think the only solutions are '# ', which has already been posted, and the f based solutions:

f0
fk
fH
fY
fZ
f"
f[
f(
f{
f]

f followed by anything falsy.

isaacg

Posted 2015-10-02T17:20:15.947

Reputation: 39 268

Thanks, I hadn't noticed that one. I'll remove it. @Dennis – isaacg – 2015-10-03T20:53:38.560

9

Microchip PIC Machine Code, 0 bytes

An unprogrammed/erased PIC will by default have the program memory (flash) contain all NOP instructions. NOP does nothing.

Now, NOPs by themselves don't implement infinite loop. But the PIC program counter by design wraps around back to zero. Therefore, an unprogrammed/erased PIC executes an infinite loop.

Note: This is true for a lot of CPU architectures. Especially microcontrollers.

slebetman

Posted 2015-10-02T17:20:15.947

Reputation: 629

Interesting. For reference, on x86: 00 00 is add [eax], al. (or rax for 64bit code.) So it will segfault unless eax happens to hold a valid pointer. – Peter Cordes – 2015-10-06T00:43:10.447

@PeterCordes: Depending on the CPU family, erased EEPROM can have values of either 0xfff or 0xffff (PICs have weird word length for program memory - like 12 bits or 10 bits etc.). But it is always interpreted as NOP. A segfault triggers an interrupt right? So if the interrupt handler for segfault is also null it would continuously re-segfault. Isn't that a loop? – slebetman – 2015-10-06T02:56:01.867

Oh right, so EEPROMs are like NAND flash, and erase to one, not zero. Neither 0F FF nor FF FF are valid instructions in x86 machine code, in 16, 32, or 64bit mode. In Unix, a segfault results in a SIGSEGV signal being delivered to the process by the OS. An illegal instruction results in a SIGILL. The default action is to terminate the process. If the process had earlier installed a signal handler (with the sigaction(2) system call), it could catch SIGSEGV or SIGILL. It's a much better design to default to killing processes that run bad code, vs. inf loop! – Peter Cordes – 2015-10-06T20:26:43.073

1@PeterCordes: I'm talking about a bare x86 CPU with all the data pins soldered to ground - it won't be able to load any OS but it should permanently segfault. Though I wonder, if you need to add 1 byte for every command line flag passed to the interpreter how many points do you need to add if you solder the pins on the CPU? – slebetman – 2015-10-06T20:58:11.903

Oh right, of course you wouldn't have an OS on unprogrammed memory. But it's only a "segfault" if you're running under a Unix-like OS. You're talking about a #GP(0) general-protection fault or #UD undefined insn fault. The only way a bare CPU will actually "stop" is if you run some kind of halt-until-next-interrupt instruction. The default behaviour is to keep running, even if it's a loop of illegal-instructions in the illegal-instruction-handler. I'd consider a fault to be the hardware running your program again, rather that the prog being a loop, and thus less interesting. – Peter Cordes – 2015-10-06T21:22:31.280

So I think it's an interesting answer for CPUs where 0F FF or FF FF encodes a NOP and the instruction pointer loops, but not for CPUs that only loop by faulting on either that insn encoding or when they get to the end of memory (e.g. if they have some unmapped address space that isn't backed by EEPROM, and reading that faults instead of also being a NOP). – Peter Cordes – 2015-10-06T21:27:30.920

8

Mouse, 5 3 bytes

()$

This is just a simple "while true do nothing."

Saved 2 bytes thanks to cat.

Alex A.

Posted 2015-10-02T17:20:15.947

Reputation: 23 761

15So, what you're saying is that Cat took two bytes out of Mouse, but didn't eat the whole thing? – Steve Eckert – 2016-01-12T13:56:11.097

@SteveEckert Haha. :D – HyperNeutrino – 2016-05-01T22:36:18.417

8

Turing Machine Code, 9 bytes

As usual, I'm using the rule table syntax defined here.

0 _ _ * 0

"When in state 0, upon reading an empty cell, replace it with an empty cell, don't move, and transition to state 0."

SuperJedi224

Posted 2015-10-02T17:20:15.947

Reputation: 11 342

8

C, 11 bytes (on old x86)

main=65259;

65259 or 0xfeeb is the machine code eb fe or jmp -2. Jumps are relative to the next instruction, so this loops.

This compiles (with a warnings) and works on my Linux 2.4.9.
Newer Linux will usually put main in a non-executable section. Adding const will fix it, but at an unbearable price.

Just noticed kirbyfan64sos's answer that uses the same machine code. But it's not in C.

ugoren

Posted 2015-10-02T17:20:15.947

Reputation: 16 527

Could you use -277 instead of 65259? – anatolyg – 2019-12-11T17:26:03.940

@anatolyg, yes, it indeed saves a character. – ugoren – 2019-12-14T07:33:34.200

7

C, 17 bytes

main(){l:goto l;}

Why not for(;;);? Because goto are cool.. and 17 is a nice number

wendelbsilva

Posted 2015-10-02T17:20:15.947

Reputation: 411

5-1, intentionally not as short as possible. main(){for(;;);} is one byte shorter, at 16B. – Peter Cordes – 2015-10-06T21:15:13.753

@PeterCordes Why not main(){main();}? – Alchymist – 2015-10-21T15:09:53.253

2Hi @PeterCordes. For it to work, I needs to pass an option to the compiler.. so I decide to go pure C. Check Mark's solution at the first page of this codegold, where he proposes main(){main();}. – wendelbsilva – 2015-10-21T16:15:46.443

7

Macaroni 0.0.2, 14 chars

label a goto a

Fairly self-explanatory...

Doorknob

Posted 2015-10-02T17:20:15.947

Reputation: 68 138

1-1 because you wrote Macaroni in Rust, and I don't have Rust right now, so I can't use it. :( (jk, I actually upvoted.) – kirbyfan64sos – 2015-10-05T21:37:30.543

7

VBA (immediate pane), 14 bytes

This will freeze up the VBE and its host app:

do:loop

Mathieu Guindon

Posted 2015-10-02T17:20:15.947

Reputation: 181

1:goto 1 beat me by one... – RubberDuck – 2015-10-05T22:16:46.343

I think this is only 7 bytes, why did you say 14? – SuperJedi224 – 2016-02-14T12:30:47.243

@SuperJedi224 I wasn't sure if the IDE itself was like that, but VBA strings are 2 byte per character, ..I went for the worst-case figure :-) – Mathieu Guindon – 2016-02-14T14:11:47.737

7

Malbolge, 1 byte

 

A single-space program causes Ben Olmstead's reference implementation to loop forever. Can you find out why?

Lynn

Posted 2015-10-02T17:20:15.947

Reputation: 55 648

1Wouldn't this be UF, looking for indices -1 and -2 of mem? – LegionMammal978 – 2015-10-25T11:27:30.293

7

Chef, 75 52 46 bytes

Saved 23 bytes thanks to @Sp3000

L.

Ingredients.
1 i

Method.
X i.M until xed.

Try it online! (if you dare)

Basically, this program repeatedly checks that i (always 1) is greater than zero, and while it is, Ms the empty mixing bowl. I tried to stick to the original spec as much as possible, so it may be able to golf this even more. Thanks to TIO, I can now verify my changes with a copy of the interpreter!

ETHproductions

Posted 2015-10-02T17:20:15.947

Reputation: 47 880

The add actually breaks it because you never put anything into the bowl. Note that verb the ingredient checks the ingredient itself, rather than the mixing bowl, so you can just drop the add altogether. Other golfs 1) Drop g from 1 g i 2) Replace Mix like you say, e.g. X the i.Mix until xed 3) Serves is optional – Sp3000 – 2015-10-05T07:38:37.643

@Sp3000 O great Resident Chef Master, thanks for your input! It's now down to 52 bytes. – ETHproductions – 2015-10-05T16:58:39.690

6

PHP, 8 bytes

for(;;);

When running from command line (-r argument) you don't need php openning/closing tags.

Ex.: php -r "for(;;);"

wesleyjefferson

Posted 2015-10-02T17:20:15.947

Reputation: 69

3This produces an error PHP Parse error: syntax error, unexpected end of file in Command line code on line 1 or Parse error: parse error in Command line code on line 1 depending on the PHP version used and when run like php -r "for(;;)". You need at least one additional ; at the end. – insertusernamehere – 2015-10-02T22:00:39.397

6Rule 1: Each submission must be a full program, in this case <?for(;;);. – primo – 2015-10-03T04:20:27.600

@primo this is a full program – NieDzejkob – 2018-03-15T17:07:14.067

6

APL, 8 5 4 bytes

-⍣=1

This repeats negation until the result is equal to the previous input (beginning at 1) which can't happen, so it loops indefinitely.

Saved 3 bytes thanks to Dennis and 1 thanks to jimmy23013!

Alex A.

Posted 2015-10-02T17:20:15.947

Reputation: 23 761

s/forever/until the stack overflows – kirbyfan64sos – 2015-10-02T19:52:48.153

@kirbyfan64sos Hah, good point. – Alex A. – 2015-10-02T19:55:49.653

Or -⍣=1 . – jimmy23013 – 2015-10-03T00:30:58.347

@jimmy23013 I don't understand that code. What does it do? – Alex A. – 2015-10-03T00:32:14.373

Repeat negation until the result is the same as the input. – jimmy23013 – 2015-10-03T00:33:41.680

@jimmy23013 Oh awesome, thanks! That saves another byte. – Alex A. – 2015-10-03T00:43:53.357

And the input is the previous output, while it is 1 in the first iteration. – jimmy23013 – 2015-10-03T01:06:01.300

Wonder if ⊢⍣≢ is valid as it constitutes a function... – Adám – 2016-02-12T15:45:44.003

6

X86/X64 Machine Code, 2 bytes

Hex dump:

0xEB 0xFE

Disassembled source code:

f:jmp f

Basically, because the entry point _start isn't defined, ld defaults to the address that is coincidentally the location of f.

kirbyfan64sos

Posted 2015-10-02T17:20:15.947

Reputation: 8 730

1In some dialects of assembly you can write this as jmp . or jmp $ without a label. – Random832 – 2015-10-02T22:56:28.340

@Random832 The exact same machine code is generated, though, so it doesn't mean anything. – kirbyfan64sos – 2015-10-02T23:10:51.937

2

I stuck these 2 bytes into a malformed ELF header to produce a 45 byte executable program http://codegolf.stackexchange.com/a/59479/19694

– casey – 2015-10-03T03:33:34.600

On DOS, you could put just those two bytes in a .COM file. – celtschk – 2015-10-04T11:54:52.843

1

@casey: If you're interested in ASM source size, I posted a 4-byte x86 YASM/NASM answer, which works on Linux: ja $. I included an explanation of how it works as a complete program.

– Peter Cordes – 2015-10-06T21:11:36.040

6

JavaScript, 8 bytes

NOTE: This is the same as the existing Processing answer; just posting it for the sake of catalogue completeness.

for(;;);

Bonus: Here's a 12-byte ES6 alternative, using recursion instead:

a=_=>a();a()

ETHproductions

Posted 2015-10-02T17:20:15.947

Reputation: 47 880

1For the JavaScript version you can drop the final semicolon to save a byte ;-) – scunliffe – 2015-10-03T03:10:45.523

3@scunliffe No, you can't. Just paste for(;;) into your browser console if you don't believe me. (The reason is that a for loop must execute at least one statement, even if it's an empty one.) – user2428118 – 2015-10-03T12:29:17.717

@scunliffe Yes, I actually tried that, but as user2428118 pointed out, it doesn't work. – ETHproductions – 2015-10-03T19:12:01.237

isnt this a standart loop? – Alex – 2015-10-09T12:57:48.610

1

@Alex Um, yes, it's a standard JS loop. Is there something wrong with that? Or did you mean standard loophole?

– ETHproductions – 2015-10-09T16:22:53.797

@ETHproductions yep, I mixed those up :) sorry – Alex – 2015-10-11T11:22:12.343

alt way for the 12-byte ES6 way: (a=_=>a())(), looks even scarier xD – Brian H. – 2017-11-23T11:39:28.090

6

Unlambda, 7 bytes

``ci`ci

Try it here. It uses c (call-cc) which is a little magical.

Lynn

Posted 2015-10-02T17:20:15.947

Reputation: 55 648

1A little magical? :-) – celtschk – 2015-10-04T12:00:06.410

6

Starry, 9 bytes

`      +'

Loops in Starry are written with ` (which marks the current location in the code as label n, where n is the number of spaces in front of it) and ' (which pops a value from the stack and jumps to label n if that value was non-zero). So we use these two n = 0. But that leaves the question how to get a non-zero value onto the stack. I believe the shortest way to do is simply to push a 1, which requires 6 spaces and a +.

Martin Ender

Posted 2015-10-02T17:20:15.947

Reputation: 184 808

6

Mornington Crescent, 117 106 Bytes

Take Northern Line to Bank
Take Circle Line to Temple
Take Circle Line to Bank
Take Northern Line to Angel

There appear to be some bugs in the Python interpreter, but the language's creator has a C# interpreter that works for this code.

*Inspired by @ETHproductions

EDIT: Since it doesn't ever terminate, can remove required return to Mornington Crescent

Thanks Martin Büttner for 8 bytes, and Timwi for 3 bytes.

Fongoid

Posted 2015-10-02T17:20:15.947

Reputation: 971

Using Bank instead of Moorgate saves 8 bytes. (My prime tester answer has a CJam script that helps when finding the shortest path between two stations.)

– Martin Ender – 2015-10-07T14:34:21.223

Esoteric IDE does not require Windows EOL. I saved your program with UNIX line endings and the IDE opens and interprets it fine. :) – Timwi – 2015-10-07T14:42:40.250

2@MartinBüttner Yes, should have looked at the actual code, instead of the London tube map :P – Fongoid – 2015-10-08T13:49:04.857

5I love the fact that ^that comment was able to happen. "I would have been able to make this code shorter but I was looking at the London tube map." – undergroundmonorail – 2015-10-08T14:11:48.860

@undergroundmonorail Username checks out ;) – ThreeFx – 2016-09-10T15:18:28.247

6

Piet, 2 Codels

2 Codels is as small as a loopy Piet program gets.
With only 1 codel the 8 waits needed for a finish would be immediatly met.

2 codel loopy Piet

In the example (10 pixel codelsize) the difference between the 2 colours are +2/-2 Hue delta and +2/-2 Light delta. So it keeps on repeating a "roll" "not".

LukStorms

Posted 2015-10-02T17:20:15.947

Reputation: 1 776

5

Ruby, 6 bytes

Pretty self explanatory. Ok, my post is long enough now.

loop{}

daniero

Posted 2015-10-02T17:20:15.947

Reputation: 17 193

1And I came here thinking I could win with (1..1.0/0).all?. – Cyoce – 2016-04-16T22:08:03.187

same for rust lol – Chromium – 2018-06-25T10:31:01.863

5

Processing, 8 bytes

for(;;);


This is based on Geobit's answer in Java


Although the code below is not the shortest, it is one of Processing's specialties.

void draw(){}

This draw statement repeats itself over and over again. It is one of the differences between Processing and Java.

user41805

Posted 2015-10-02T17:20:15.947

Reputation: 16 320

4You can also add JavaScript to your title, code stays the same=) – flawr – 2015-10-02T18:11:50.650

5

CJam, 4 bytes

1{}h

Put a 1 on the stack, and loop until 1 is no longer truthy. Using h means that the number is never popped.

jqblz

Posted 2015-10-02T17:20:15.947

Reputation: 2 062

5Alternatively, {1}g. – Martin Ender – 2015-10-02T19:01:49.617

5

C++ 11 template metaprogramming, 58 54 bytes

template<int>struct I{int v=I<1>{}.v;};int a=I<1>{}.v;

C++ helpfully comes packaged with 2 other turing complete languages: the C preprocessor, and template metaprogramming. Note that this does reach a max recursion depth at some point, but the OP clarified that this is okay.

Example run:

g++: internal compiler error: Segmentation fault (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

Justin

Posted 2015-10-02T17:20:15.947

Reputation: 19 757

This is even shorter (41 bytes): template<int I>class A{A<I+1> a;};A<0> a;

But unfortunately, it requires the -ftemplate-depth option to be set to something rather high, I used 999999 in this example.

– iFreilicht – 2015-10-16T14:08:29.533

And a Preprocessor answer might be impossible unless there's a compiler that allows to set the maximum inclusion recursion depth or number of replacement sweeps per file. – iFreilicht – 2015-10-16T14:10:25.707

@user75200 Next time please add a comment instead of editing someone else's answer when you have a suggestion to golf it further. @user75200 suggested you can remove both int, so it becomes template<int>struct I{v=I<1>{}.v;};a=I<1>{}.v; (46 bytes) – Kevin Cruijssen – 2017-10-24T08:13:46.383

1@KevinCruijssen/user75200 That doesn't work; types aren't assumed to be int in C++ – Justin – 2017-10-24T08:18:17.487

@Justin Ah ok. I only programmed in C++ once during college, so I barely know anything about it. Simply rejected the edit and placed this comment. :) – Kevin Cruijssen – 2017-10-24T08:23:33.417

5

Beam, 2 bytes

There is a few ways of doing this from the very basic

><

to the very basic

>?

and

>|

MickyT

Posted 2015-10-02T17:20:15.947

Reputation: 11 735

I just came over here to post this, but then I noticed it in the catalogue snippet. +1 – ETHproductions – 2015-10-02T22:41:44.700

5

TI-BASIC, 2 bytes

If recursion is allowed (is it a loop?)

prgmA

Runs a program named 'A', hence the program must be named the same. Some research revealed that prgm is 1 byte, plus 1 byte for A

Runs out of memory pretty quickly, but that doesn't seem to be addressed above.

Stretch Maniac

Posted 2015-10-02T17:20:15.947

Reputation: 3 971

1: is the mandatory beginning of each line, and I believe that isn't counted. Also, the title shouldn't be counted. Do you count a .js file name into the byte count? I'll look into the prgm token, though it's a single command. – Stretch Maniac – 2015-10-03T00:27:56.460

In this case, however, the actual title is irrelevant as long as it matches the command. – Stretch Maniac – 2015-10-03T00:39:09.120

However, the program would have to be lengthened for longer titles. A valid program would somehow have to find its own name. – LegionMammal978 – 2015-10-03T00:47:56.897

This is indeed valid and two bytes long. – lirtosiast – 2015-10-05T23:11:32.147

1Isn't it three bytes: 1 for the A in the program name – pppery – 2017-07-31T21:44:59.060

2Why do people always add : to the start of each line? It's just a part of the editor, not the actual code. – 12Me21 – 2018-02-12T15:23:50.560

5

AWK, 12 bytes

END{for(;;)}

Does nothing with each line of input, then hangs forever at the end.

Lynn

Posted 2015-10-02T17:20:15.947

Reputation: 55 648

This actually requires input. So it will wait forever before entering the loop, if nothing is input. If waiting forever counts, then 0 is the shortest code. Since it is a label, which requires input, but it also won't print anything. – Robert Benson – 2017-04-11T13:49:10.327

5

JavaScript, 8 bytes

for(;;);

Since the expression to evaluate is omitted, it will always evaluate to true (i.e. your classic while(true){} loop in "disguise").

Cyoce

Posted 2015-10-02T17:20:15.947

Reputation: 2 690

You don't need the ; at then end. – Grant Davis – 2015-10-09T14:50:58.240

2@GrantDavis Yes you do. The for loop still expects a statement, and the semicolon tells that there is no statement. – Conor O'Brien – 2016-04-16T23:26:41.443

5

Tcl/Tk, 0 bytes

Execute any empty file with the wish interpreter instead of tclsh.

slebetman

Posted 2015-10-02T17:20:15.947

Reputation: 629

5

MarioLANG, 3 bytes

!
=

I found several other solutions, but they seem to be bugs in the Ruby interpreter rather than features of the language (e.g. replacing ! with @). This one actually seems to work intentionally. = is just a ground cell for Mario to stand on, and ! instructs him to stop walking. So he just stands there, waiting for something to happen, which of course doesn't. (The usual purpose of ! is to use it on elevators, such that Mario remains in place while the elevator moves to its target position.)

Martin Ender

Posted 2015-10-02T17:20:15.947

Reputation: 184 808

This doesn't work on tryitonline i guess that it consider the program finished since mario is not moving at all, the next intuitive solution ' ^=' (marioLANG ain't easy to do in comment :/) doesn't work either

– Ether Frog – 2016-05-24T19:54:35.883

@EtherFrog I think TIO uses a different interpreter than the Ruby interpreter I tested this with. – Martin Ender – 2016-05-24T21:28:15.660

5

Brian & Chuck, 7 bytes

#{?
#{?

The # could be replaced by any other characters except null-bytes or underscores.

The idea is fairly simple:

  • Brian moves Chuck's instruction pointer to the start ({) and hands control over to him (?).
  • Chuck moves Brian's instruction pointer to the start ({) and hands control over to him (?).
  • Repeat.

Martin Ender

Posted 2015-10-02T17:20:15.947

Reputation: 184 808

5

Jelly, 1 byte

ß

Recursively calls the main link. Thanks to tail call optimization, this results in an actual infinite loop.

Try it online!

Dennis

Posted 2015-10-02T17:20:15.947

Reputation: 196 637

01¿, without recursion. – Erik the Outgolfer – 2016-09-10T10:47:07.097

5

Binary Lambda Calculus, 3 bytes

Before I dive into the explanation, let's start with the program itself.

F†€

Trust me, it's pure luck that they're all printable, and I'll get to why it is 2 1/4 bytes instead of 3 after the explanation. I'll explain this by walking through the process I took to create this program.

To start, BLC programs are just lambda calculus programs encoded in a special way. With this in mind, let's begin with the lambda calculus program that enters an infinite loop, known as omega.

(λx.xx)(λx.xx)

This results in an infinite loop because, according to Wikipedia, it reduces to itself after a single beta-reduction. To convert this into BLC, we must first convert it to De Bruijn indices. It converts into the following:

.λ.11λ.11 (The dots after the λs are necessary for BLC but not part of De Bruijn indices)

Okay, now that it's in De Bruijin indices we can now convert it into BLC where λ translates to 00, function application or . translates to 01, and numbers are represented as 1^n0 where n is the number. Knowing this, it translates into the following binary:

01 00 01 10 10 00 01 10 10

This is why it's 2 1/4 bytes. As BLC instructions aren't full bytes (with the exception of 7), it is rare for programs to fit exactly into a certain byte count. To turn this into hex, we have to pad it in order to make it fit into 3 bytes. Doing this yields the following:

46 86 80

There we have the hex dump of our program! It runs in an infinite loop, doesn't run out of memory to my knowledge, doesn't output anything, and is a complete program that can be saved and run by piping the contents of the file to the official interpreter. You can also pipe the binary text to the interpreter and add the -b flag, to demonstrate that the non-padded version can be run.

Zwei

Posted 2015-10-02T17:20:15.947

Reputation: 484

5

Cubix, 0 bytes


Alternatively, any single character does exactly the same.

Test it online!

Cubix is a stack-based 2D language, created by me in March 2016. Cubix differs from ordinary 2D languages in that it's not strictly 2D: the code is wrapped around a cube. Any one-byte program wraps to this cube net:

   ?
>. . . .
   .

where ? represents the character, and the IP (instruction pointer) starts at the arrow. . is simply a no-op, and when the IP reaches the right side of the cube net, it simply wraps back around to the left. Thus, any 1-byte program does nothing forever, no matter what the character is (as long as it's not whitespace).

Thanks to @ErikGolferエリックゴルファー for reminding me that the empty program does the same. When Cubix was originally created, this didn't work, because the interpreter created a cube of size 0 and threw an error when it tried to run. This was fixed a while ago, and it is now impossible to cause an error in Cubix.

ETHproductions

Posted 2015-10-02T17:20:15.947

Reputation: 47 880

4

Lost, 0 bytes

Try it online!

Another 2D language with a zero byte answer. Funnily enough, the minimum byte count to terminate consistently is 5 bytes:

%@
//

Try it online!

Jo King

Posted 2015-10-02T17:20:15.947

Reputation: 38 234

4

x86-16 Assembly, IBM PC DOS, 2 bytes

There's quite a few machine code answers, but thought I'd contribute a few different takes.

56    PUSH SI    ; push 100H onto stack
C3    RET        ; pop stack and jump to address (PUSH SI)

On DOS when a program is started the SI register contains the starting address of the program (generally 100H). Push that onto the stack and execute a RET which will pop the stack and jump to that address. Big ol' loop.


x86-16 Assembly, 1 byte

F4   HLT         ; halt the processor and wait for signal

Okay, so this may depend a little on your definition of infinite loop. The HLT instruction (specifically in 8086 real mode) puts the processor in HALT state and awaits a signal in the form of BINIT#, INIT#, RESET# or interrupt (ref). While it's not technically executing our code, it is in a microcode loop of sorts waiting for one of those signals.


Motorola 6800, 2 bytes

9D DD   HCF      ; halt and catch fire

From Wikipedia:

When this instruction is run the only way to see what it is doing is with an oscilloscope. From the user's point of view the machine halts and defies most attempts to get it restarted. Those persons with indicator lamps on the address bus will see that the processor begins to read all of the memory, sequentially, very quickly. In effect, the address bus turns into a 16 bit counter. However, the processor takes no notice of what it is reading… it just reads.

640KB

Posted 2015-10-02T17:20:15.947

Reputation: 7 149

4

GNU dc, 6 bytes

[dx]dx

Tail recursion FTW, which GNU dc supports. Others might not.

Digital Trauma

Posted 2015-10-02T17:20:15.947

Reputation: 64 644

That's my length 6 dc snippet :) But on my machine it just crashes. Is that normal?

– daniero – 2015-10-02T18:27:26.177

Which machine do you have? (and which dc?). I'm running GNU dc on Linux, which supports infinite tail recursion. I think possibly other dcs don't support any kind of tail recursion, and end up crashing with a stack overflow. – Digital Trauma – 2015-10-02T20:05:57.263

A mac, using the pre-installed dc. It says dc (GNU bc 1.06) 1.3. I see that it works on a Linux box with the slightly newer version (1.3.95) – daniero – 2015-10-02T20:14:29.847

4

MUMPS, 1 byte

f

This is the equivalent of for ( ; ; ) ; in C-like languages. It runs from the prompt as is, though, and does not need to be wrapped in a function declaration or any such thing.

senshin

Posted 2015-10-02T17:20:15.947

Reputation: 641

4

MSM, 2 bytes

ee

Almost all 2 character strings will work, even two spaces, just don't use any of the following 6 commands :,/.?'.

nimi

Posted 2015-10-02T17:20:15.947

Reputation: 34 639

4

Commodore Basic, 3 bytes

1R╭

PETSCII substitution: = SHIFT+U, ungolfs to 1 RUN.

Taking advantage of Commodore Basic's shortcut forms and the fact that any immediate-mode command can also be used in a program, this code simply runs itself, forever.

Alternatively, a more thoroughly infinite loop is the immediate-mode command

S|7

(PETSCII: | = SHIFT+Y, ungolfs to SYS 7).

This transfers execution to memory location 0x0007. The BASIC interpreter stores the current search character here; when running the above code, this character is the double-quotation mark with byte value 0x22. Opcode 0x22 is an undocumented HALT opcode, which works by putting the 6510's micro-operation interpreter into an infinite loop. The only way out of this loop is to reset the computer.

Mark

Posted 2015-10-02T17:20:15.947

Reputation: 2 099

How about a note on what R and Shift+U respectively Sand Shift+Y will expand to? And You could submit a 6510 assembler program. – Titus – 2016-12-01T00:36:59.033

On the Commodore 64 and VIC-20 you can also use 0 GOTO - if you do not specify a number then GOTO assumes that you mean GOTO 0. As Commodore BASIC on the C64 and VIC are recycled from earlier CBM/PET machines, this may also work on those computers. It does not work on the C128 in native mode though. – Shaun Bebbers – 2017-01-26T11:36:56.593

4

Mathematica, 10 8 bytes

0~Do~∞

LegionMammal978

Posted 2015-10-02T17:20:15.947

Reputation: 15 731

3Alternatives with the same byte count: For[,1>0,] and While@True. Unfortunately #0[]&[] hits the iteration limit pretty quickly and exits with an error. – Martin Ender – 2015-10-03T19:15:43.453

@MartinBüttner In fact, I was about to use your third suggestion before remembering about $IterationLimit... – LegionMammal978 – 2015-10-03T20:56:28.747

2 bytes shorter: 0~Do~∞ – shrx – 2016-03-09T20:48:07.690

@shrx Remember that is 3 bytes long in UTF-8. – LegionMammal978 – 2016-03-09T20:49:14.353

@shrx Now that I think about it, are you sure that it works? It gives me an error on v10.1. – LegionMammal978 – 2016-04-02T00:00:37.273

Yeah it works in 10.3.1 and 10.4.0 for me. – shrx – 2016-04-02T08:05:55.237

4

COBOL, 51 bytes

ID DIVISION.PROGRAM-ID.A.PROCEDURE DIVISION.B.GO B.

Lynn

Posted 2015-10-02T17:20:15.947

Reputation: 55 648

procedure division. a. go to a. That's with cobc -frelax-syntax -free -x *filename* but probably counts towards bytes. What COBOL are you using that allows yours to compile with no flags/options? Same for your other COBOL answer. – Bill Woodger – 2016-03-02T15:08:10.147

4

z80 Machine Code, 1 byte

c7       ; RST 00h

Or if assuming the code starts at 0000h is cheating, two bytes:

18 fe    ; JR -2

These solutions make no assumptions about the rest of the environment's RAM. If it's filled with zero bytes, we are just spinning through NOPs forever, so we could have a 0-byte solution. (Thanks to Thomas Kwa for pointing this out.)

Lynn

Posted 2015-10-02T17:20:15.947

Reputation: 55 648

Good point; I've written a note about it. – Lynn – 2015-10-04T19:20:50.037

1For special fun, fill RAM with 0xDD (or 0xFD). Or maybe this isn't an infinite loop, because it's just one infinitely long opcode. – Philip Kendall – 2015-10-06T16:36:54.337

1Byte = 76 ; Halt https://codegolf.stackexchange.com/a/166100/80745

– mazzy – 2018-06-04T10:01:34.343

4

Scheme, 12 bytes

A tail-recursive infinite loop seems most appropriate for scheme :-)

(let l()(l))

even though (do(())()) (the CL variant of which is due to @JoshuaTaylor) would be 2 bytes shorter.

xebtl

Posted 2015-10-02T17:20:15.947

Reputation: 941

4

Fortran, 11 bytes

It is not very creative, but here is the shortest I found:

1goto 1
end

I am pretty sure this is not standards compliant, but it compiles with ifort.

xebtl

Posted 2015-10-02T17:20:15.947

Reputation: 941

4

3var, 2 bytes

{}

To quote the docs:

{   Starts a loop which repeats forever
}   Ends a loop which repeats forever

Sp3000

Posted 2015-10-02T17:20:15.947

Reputation: 58 729

4

Rust, 17 bytes

Didn't see one in rust so:

fn main(){loop{}}

real original and interesting and so different from all the other entries.

Liam

Posted 2015-10-02T17:20:15.947

Reputation: 3 035

When I try this on the playground, it prints to stderr. – MutantOctopus – 2018-01-23T13:10:13.473

@BHustus What is it printing to stderr? I'm not getting anything. – Liam – 2018-01-23T22:23:04.247

Besides the standard compilation details, running results in /root/entrypoint.sh: line 7: 6 Killed timeout --signal=KILL ${timeout} "$@" via this link: https://play.rust-lang.org/?gist=79c6d9d28f5c35bd8a4d163880882296&version=stable That -might- just be the playground and not the actual compiled product though, I didn't have the chance to test a compiled version.

– MutantOctopus – 2018-01-24T00:05:31.617

@BHustus It's an infinite loop and so the playground kills it after a timeout because they don't want to waste time running my code endlessly. If you run this on a desktop that shouldn't happen. – Liam – 2018-01-24T02:24:43.617

In that case, disregard what I said. – MutantOctopus – 2018-01-24T05:18:15.287

4

R, 8 bytes

repeat{}

I believe this is the shortest way to make a loop that won't stop. We would need an infinite length list to use a for loop and while(T) is longer than repeat.

Dason

Posted 2015-10-02T17:20:15.947

Reputation: 260

I thought I had, but it sure as hell doesn't work -- dunno what I did. Sorry about that. – user5957401 – 2017-10-13T18:54:49.223

2+1 : This or equivalently repeat 1 (or repeat x with x being any valid single character expression) – digEmAll – 2018-06-04T08:11:16.843

@digEmAll doesn’t repeat 1 output something? – JayCe – 2018-06-25T01:43:11.847

@JayCe: I also thought so, but actually it doesn't... – digEmAll – 2018-06-25T06:25:08.527

4

NASM/YASM x86 assembly, 4 bytes

ja $

$ is the address of the current instruction, and ja jumps there if the carry and zero flags are both unset. (i.e. the Above condition is true.) This is the case in x86-64 Linux at process startup.

ja$ just defines a symbol, instead of being an instruction, so the space is not optional. I did test that this works without a trailing newline, so it really is 4 bytes.

Assemble/link with

$ yasm -felf64 foo.asm && ld -o foo foo.o
ld: warning: cannot find entry symbol _start; defaulting to 0000000000400080

The x86-64 ABI used by Linux doesn't guarantee anything about the state of registers at process startup, but Linux's actual implementation zeroes all the registers other than RSP for a newly-execed process. EFLAGS=0x202 [ IF ], so ja (jump if Above) does jump, because the carry and zero flags aren't set. jg (ZF=0 and SF=0) would also work. Other OSes that initialize flags differently might be able to use one of the other one-letter conditions that require a flag bit to be set: jz, jl, jc, jp, js.

Using ja instead of jmp (unconditional jump) makes the source one byte shorter, but the binary is the same size (2 bytes: one opcode byte, one rel8 displacement, for a total size of 344 bytes for a stripped ELF64 binary. See casey's answer for a 45 byte ELF executable if you're interested in small binary size rather than small source size.)

Peter Cordes

Posted 2015-10-02T17:20:15.947

Reputation: 2 810

4

pb, 8 bytes

In pb, the shortest possible infinite loop is 8 bytes long. In fact, there are sixty 8 byte infinite loops, none of which produce output! (Unless you're running in watch mode, which is intended for debugging, no pb programs produce output until they halt. However, even if one of these did eventually halt, no output would have been produced.) Here are the sixty shortest infinite loops, in alphabetical order:

w[B!1]{}
w[B!2]{}
w[B!3]{}
w[B!4]{}
w[B!5]{}
w[B!6]{}
w[B!7]{}
w[B!8]{}
w[B!9]{}
w[B=0]{}
w[C!1]{}
w[C!2]{}
w[C!3]{}
w[C!4]{}
w[C!5]{}
w[C!6]{}
w[C!7]{}
w[C!8]{}
w[C!9]{}
w[C=0]{}
w[P!1]{}
w[P!2]{}
w[P!3]{}
w[P!4]{}
w[P!5]{}
w[P!6]{}
w[P!7]{}
w[P!8]{}
w[P!9]{}
w[P=0]{}
w[T!1]{}
w[T!2]{}
w[T!3]{}
w[T!4]{}
w[T!5]{}
w[T!6]{}
w[T!7]{}
w[T!8]{}
w[T!9]{}
w[T=0]{}
w[X!1]{}
w[X!2]{}
w[X!3]{}
w[X!4]{}
w[X!5]{}
w[X!6]{}
w[X!7]{}
w[X!8]{}
w[X!9]{}
w[X=0]{}
w[Y!1]{}
w[Y!2]{}
w[Y!3]{}
w[Y!4]{}
w[Y!5]{}
w[Y!6]{}
w[Y!7]{}
w[Y!8]{}
w[Y!9]{}
w[Y=0]{}

These all follow a simple pattern. w is a while loop, pb's only looping or branching instruction. Inside the square brackets is the condition, which is two expressions separated by ! or =. To understand what this means, imagine an extra = just before the second expression. In the same way that you understand 2+2==4 to be true and 10!=5*2 to be false, 2+2=4 and 10!5*2 are true and false in pb. A while loop is executed until the condition becomes false. Finally, there is a pair of curly braces containing pb code. In this case, there's no code to be run, so they are empty.

The important thing here is the condition. pb has six variables, all for different purposes. They are:

B - The value of the character under the brush
C - The colour of the character under the brush (from a lookup table, the important thing being that white = 0)
P - The current colour that the brush is set to output in (same lookup table)
T - Set by the programmer, initialized to 0
X - X position of the brush
Y - Y position of the brush

The brush starts at (0, 0) on a canvas that is entirely initialized to white null bytes. This means that all of the variables start out being equal to 0.

These sixty programs fall into two categories: 10 loops that are executed until a variable (equivalent to 0) stops being zero, and 50 loops that are executed until a variable (equivalent to 0) becomes a specific non-zero number. An infinite number of programs can be written that fall into that second group, but only 50 are the same length as the 10 in the first one.

undergroundmonorail

Posted 2015-10-02T17:20:15.947

Reputation: 5 897

4

Vitsy, 1 Byte

<

Since Vitsy loops around the line, a single space is an infinite loop. This functionality was removed in the latest version, but this applies as a special condition for looping around a line.

You could technically also do it like this:

[

But it throws an error after a little while:

Exception in thread "main" java.lang.StackOverflowError
    at com.VTC.vitsy.OperativeHandler.doOperation(OperativeHandler.java:6)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:88)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    at com.VTC.vitsy.Vitsy.loopHandler(Vitsy.java:82)
    at com.VTC.vitsy.Vitsy.opHandle(Vitsy.java:195)
    ... (few hundred more lines)

It's a pretty staggeringly long error.

The 'correct' way to do an infinite loop in Vitsy, however, is this:

[1]

where 1 is any number [1-f]. [ starts a while loop, 1 pushes 1 to the stack, and ] pops the top item off the stack and tests if it is 0. If it isn't, go back to the beginning of the loop.

Addison Crump

Posted 2015-10-02T17:20:15.947

Reputation: 10 763

4

Half-Broken Car in Heavy Traffic, 5 4 bytes

^ov#

also in 4 bytes:

o
 #

anOKsquirrel

Posted 2015-10-02T17:20:15.947

Reputation: 361

I just took the interpreter for a spin, and somehow I get the feeling the looping is not in the actual code execution, but in the interpreter checking for infinite loops. Can't confirm until I manage to understand this code properly though (I don't think that affects the validity of the answer, but it's interesting...) – Sp3000 – 2015-11-04T13:00:51.417

1@Sp3000 Took it for a spin. Nice pun! – None – 2017-01-30T17:29:10.563

4

Seed, 2 bytes

0 

(note the trailing space character)

Any seed program consists out of 2 instructions, seperated by a space; The length of the Befunge program it will output and the seed which will generate that program.
Seeing how we need a Befunge program of length 0, we can create a Seed program with an empty 2nd instruction.

The Seed program 0 will output an empty Befunge program, which will run forever.

Interesting to note is that the Python compiler on the Seed esolang page is erroneous.
To create a Befunge program of length 0, any seed will do. That includes an empty seed. To stick to the spec however, the space after 0 is not omitted.

That being said, this is the world's shortest Seed program, and also the easiest to reverse engineer :-)

Bassdrop Cumberwubwubwub

Posted 2015-10-02T17:20:15.947

Reputation: 5 707

4

AutoHotkey, 8 bytes

loop {
}

Previous answer posted in AHK was wrong and did not create a infinite loop.

errorseven

Posted 2015-10-02T17:20:15.947

Reputation: 220

1You can remove the space to save a byte. – Engineer Toast – 2017-05-04T15:24:41.163

4

Mmmm(), 56 bytes

mm=m[m.m()].m;mm=mm(mm(m.m()));m[mm].m(mm);<m[mm].m(mm)>

No, I have no idea how it works either.

LegionMammal978

Posted 2015-10-02T17:20:15.947

Reputation: 15 731

3

Casio FX-7000G, 5 bytes

Lbl 0
Goto 0

Quite self-explanatory: Goto 0 indefinitely jumps back to the beginning of the program. The calculator stores each token as a byte, so Lbl and Goto are 1 byte each.

FlipTack

Posted 2015-10-02T17:20:15.947

Reputation: 13 242

3

APL, 2 bytes

→1 go to line 1 (this line)

Adám

Posted 2015-10-02T17:20:15.947

Reputation: 37 779

3

Z80Golf, 1 byte

00000000: c3                                       .

Try it online!

A jump opcode. Since memory is padded with zeroes, the argument is $0000, so that the PC forever jumps from $0000 to $0000.

Lynn

Posted 2015-10-02T17:20:15.947

Reputation: 55 648

3

Lua, 9 bytes

Here are all of the different ways (that I know of) to make an infinite loop in Lua, from shortest to longest:

Goto loop (Lua 5.2.0 beta-rc1 only) at 9 bytes:

@a:goto a

This is no longer possible in the latest version of Lua since the syntax for goto has changed, so this is now the shortest infinite loop at 11 bytes:

::a::goto a

The best that you can do using a while loop is 13 bytes by using an empty string, which Lua considers to be truthy, as the conditional:

while""do end

Here is a 14 byte repeat until loop using an uninitialized variable, which is always nil, as the conditional:

repeat until a

Tied with the return until loop, as well as my personal favorite, a recursive function using load() at 16 14 bytes: (-2 bytes thanks to Jonathan French)

f=load"f()"f()

An infinite for loop made by Jo King at 18 bytes:

for _=1,1,0 do end

Finally, the longest of the methods that I know of, a normal recursive function at 22 bytes:

function f()f()end f()

I'm curious to see if anyone can find some other methods.

GalladeGuy

Posted 2015-10-02T17:20:15.947

Reputation: 101

I think for _=1,1,1e-16 do end (22 bytes) could work as an infinite for loop. – Jonathan Frech – 2018-08-06T02:01:01.943

2Could the outer parentheses in f=load("f()")f() not be omitted? – Jonathan Frech – 2018-08-06T02:11:40.810

1Thanks for the suggestion with the load loop, that would work. However wouldn't the for loop that you suggested eventually end, given enough time? – GalladeGuy – 2018-08-07T02:09:12.417

Well now I feel dumb for not thinking of that myself. Added. – GalladeGuy – 2018-08-07T02:24:10.690

I based my loop on the fact that 1+1e-16 == 1; I guess using an actual zero works too ... – Jonathan Frech – 2018-08-07T12:38:30.810

3

µ6, 1 byte

@+

Try it online!

Explanation

The µ-operator takes a function and returns the least \$n\$ that results in a \$0\$ and since there is no \$n\$ such that \$n+1 = 0\$ this program won't terminate:

@   -- µ-operator applied to
 +  -- | successor function

ბიმო

Posted 2015-10-02T17:20:15.947

Reputation: 15 345

3

Stack Cats -m, 5 4 bytes

{>}I

Try it online!

-1 byte thanks to negative seven

        Since there is no input, the stack starts with nothing but -1 on the top.
{       Remember the current value on top of the stack, and loop:
 >      Move the head right on the tape of stacks. (All of them are filled with zeroes.)
  }     Repeat while the top of the stack is not as it was remembered.
   I    Since the loop goes on forever, this is just to make the program legal.

Unrelated String

Posted 2015-10-02T17:20:15.947

Reputation: 5 300

Since the choice of central involution doesn't matter, the shortest corresponding program without a flag to mirror is -(>)(<)-, which is not a cat program on account of failing to terminate. – Unrelated String – 2019-05-31T06:56:40.470

1You can save a byte by using a {} loop, removing the need for -. – negative seven – 2019-05-31T08:50:12.760

Ah, thanks! I was sure that was the right loop until I actually figured out what I was doing, and then I promptly forgot. – Unrelated String – 2019-05-31T08:54:56.417

3

Element, 3 bytes

!{}

The control stack is initially empty, the ! negates it to truthy, and {} is a loop-while-true which never ends.

PhiNotPi

Posted 2015-10-02T17:20:15.947

Reputation: 26 739

3

TI-BASIC, 4 Bytes

While 1
End

Also:

Lbl A
Goto A



This last language isn't really an answer, as the language does not exist… yet. So, yeah, just some information, and how one might accomplish this task

Simplex, 1 Byte

O

Simple enough. Simplex has the O command, which goes to the _N_th character in the source code, with N being the current byte. Since, by default, a byte is 0, this continues to go to the first character in the source code (zero-based).

Conor O'Brien

Posted 2015-10-02T17:20:15.947

Reputation: 36 228

1TI-BASIC is 4 bytes. The 10-byte program header is counted in the MEM menu, but not here. – lirtosiast – 2015-10-02T19:39:27.467

Oh! Thanks. ^_^ – Conor O'Brien – 2015-10-02T20:35:45.310

Why not simply, for a program named W, :pgrmW? – DDPWNAGE – 2016-02-17T07:38:17.680

@DDPWNAGE because then (1) I would have to include the ten byte header, and/or (2) because the calculator will run out of resources. – Conor O'Brien – 2016-02-17T12:47:01.277

3

rs, 3 bytes

+/1

Note that this will eventually run out of memory...

kirbyfan64sos

Posted 2015-10-02T17:20:15.947

Reputation: 8 730

3

x86 Intel Assembly (NASM), 5 bytes

jmp $

nom

Posted 2015-10-02T17:20:15.947

Reputation: 131

1

I posted a 4-byte improvement on this, which works on Linux: ja $. I included an explanation of how it works as a complete program.

– Peter Cordes – 2015-10-06T21:01:05.007

3

AT&T (PDP-11) Syntax Assembly: 4 bytes

br .

PDP-11 UNIX A.OUT binary output: 24 18 bytes

0000000  000407 000002 000000 000000 000000 000000 000000 000000
0000020  000777 000000 000000 000004
0000030

This is the output produced by the assembler. As the sizes in the header show, the last three words are not necessary, it can be cut down to the first 18 bytes.

Some modern assemblers do not support the br instruction, so it would be five bytes for jmp .. And executable headers are generally much bigger these days.

Linux x86-64 binary output, after strip: 336 bytes

Now, OSX's assembler is much more strict. You must have a symbol (by default start, but here I use f) for the entry point, which balloons the size of the source. It also requires a newline at the end of the file.

Mac OS X x86-64 Assembly: 17 bytes

.globl f
f:jmp f

Mac OS Mach-O Binary Output: 4200 bytes

Random832

Posted 2015-10-02T17:20:15.947

Reputation: 796

2

You can get smaller binary output if you golf the ELF header in Linux: see http://codegolf.stackexchange.com/a/59479/19694

– casey – 2015-10-03T03:35:02.867

What machine is br . for? x86? Which assembler? GNU as rejects it for x86-64. In any case, I posted a 4-byte x86 YASM source, which assembles and links into a complete working infinite loop program on Linux: ja $. GNU ld defaults to 0x0400080 if it can't find a _start symbol, so this really is a complete program.

– Peter Cordes – 2015-10-06T21:07:51.850

@PeterCordes PDP-11 - and I assume also VAX, though I haven't had a chance to test it. It's common for older assemblers to use separate mnemonics for short jump instructions. The PDP-11 instruction contains the offset within the instruction word, with a range of even values from -64 to +62. – Random832 – 2015-10-06T21:08:23.927

@Random832: could you update your answer, then? "AT&T syntax" doesn't specify a machine. For example, there is an i386/amd64 flavour of "AT&T syntax", used by the GNU tools by default. add $16, %rsp, for example. – Peter Cordes – 2015-10-06T21:10:08.583

My answer goes into detail on the source required to make a usable x86-64 program on GNU/Linux and Mac OSX. By "AT&T" I meant the actual original assembler produced by AT&T, whose syntax is imitated by these other assemblers. – Random832 – 2015-10-06T21:11:02.317

3

ZX Spectrum BASIC, 2 bytes

1 RUN

The program will never run out of memory :-)

Explanation:

  • There is no space between the line number and the command, it is just a visual clue displayed when LISTing the program
  • The keyword RUN is one byte, in Sinclair BASIC the keywords were really just a single characters (with codepoints >=128), that just happened to look like multi-character words when displayed. In particular, you enter the keyword by pressing one key, the one with the keyword on it, and it enters one byte.

The internal representation is a bit longer (line number is stored as two bytes), but isn't this true for almost all the languages? :-)

Radovan Garabík

Posted 2015-10-02T17:20:15.947

Reputation: 437

1The internal representation also has one byte for the end of line character and one byte for the end of program character, so 5 bytes. – Neil – 2015-10-03T20:48:31.323

3

k, 4 bytes

~:/1

How it works

In k, / iterates the function on the left starting with the argument on the right until the result repeats. The ~: is a "not" function which turns 1 into 0 and 0 into 1 repeatedly in this code.

Alexander Belopolsky

Posted 2015-10-02T17:20:15.947

Reputation: 191

3

Javascript (8 bytes)

for(;;);

Edit courtody of @KritixiLithos

Javascript (10 bytes)

while(1){}

Daffy

Posted 2015-10-02T17:20:15.947

Reputation: 985

1Try for(;;); It has 8 bytes. – user41805 – 2015-10-03T09:29:52.643

@KritixiLithos I forgot that javascript for loops are basically infinite if used wrong. I'm way too used to languages like python which eventually stop for loops. Very clever :) – Daffy – 2015-10-04T10:26:57.727

Although, one can make an infinite for loop in python. – pppery – 2017-05-12T23:11:23.090

3

Go, 31 Bytes

package main
func main(){for{}}

Nothing special, the for loop without header runs infinitely.

Fabian Schmengler

Posted 2015-10-02T17:20:15.947

Reputation: 1 972

3

Beatnik, 8 bytes

K A XX K

Push a number, 1 in this case. Pop a number, if not zero skip back 4(crossed out 4) 5. There seems to be an issue with the interpreter so we need to skip back 5 instructions rather than 4.

Of course the example on the esolangs page is better.

Ha, an interminable line!

or my version

Start a neverending tale?

MickyT

Posted 2015-10-02T17:20:15.947

Reputation: 11 735

It seems like you've been caught by an off-by-one error. Replace the Y with a K to fix. Also, you've got a leading space (not included in the bytecount nor necessary). You can also add a Try It Online link. – NieDzejkob – 2018-03-06T14:14:25.737

@NieDzejkob I have changed this, but I think the interpreter is bugged in this respect. Going back 5 instructions when there is only 4 instructions seems a bit wrong. I don't think an infinite loop on TIO is a good idea. – MickyT – 2018-03-06T18:21:32.013

@MickyT TIO will self terminate code if it runs over 1 minute. – fəˈnɛtɪk – 2018-04-15T01:52:52.953

3

Lazy K, 8 7 bytes

SISSSII

Reduces to the lambda expression (λx.x x) (λx.x x) which has no normal form.

Lynn

Posted 2015-10-02T17:20:15.947

Reputation: 55 648

Tried to golf it: SISSSII (not tested). – jimmy23013 – 2015-10-04T14:41:56.990

That works! Really cool :) – Lynn – 2015-10-04T14:51:20.663

3

SQL (SQL Server 2008+), 92 bytes

WITH R AS(SELECT 1N UNION ALL SELECT N*1FROM R)SELECT*FROM R WHERE N<1OPTION(MAXRECURSION 0)

I feel a little dirty putting this up, but my original thought was that this wouldn't be possible with a SQL query. With something like T-SQL or PL/SQL not a problem, as a query though? The obvious answer was a recursive query with no recursion limit set. But how to get it to run without outputting anything. My initial tests using queries like

WITH R AS(SELECT 1N UNION ALL SELECT N FROM R)SELECT*FROM R WHERE N=0OPTION(MAXRECURSION 0);
WITH R AS(SELECT 1N UNION ALL SELECT N FROM R)SELECT*FROM R WHERE N<1OPTION(MAXRECURSION 0);

showed that the optimizer would cause the query to exit immediately with no rows returned. Using N+1 allowed it to loop, but I suspect that the integer would eventually overflow. I used N*1 in the query to avoid that and trick the optimizer into letting it run without short cutting out. I've let it run for a few minutes on my machine and it didn't seem to start consuming memory, but I can't guarantee that wouldn't happen.

MickyT

Posted 2015-10-02T17:20:15.947

Reputation: 11 735

SQL has loop constructs too, even if it's slow to use them. Why not something like: WHILE 1=1CONTINUE ? – Bridge – 2015-10-08T10:09:25.163

@Bridge SQL doesn't really have while loops. The database systems have procedural languages that have loop constructs. With this answer I was trying to keep to SQL rather than T-SQL or PL/SQL. – MickyT – 2015-10-08T17:53:29.647

Hey only trying to help, I don't have enough rep here to post my own answer. Doesn't your answer contain things that aren't ANSI SQL either, e.g. SQL Server specific extensions? The truth of the matter is, dump the code I wrote into SQL Server, and you have an infinite loop in a quarter of the code :) – Bridge – 2015-10-09T07:32:22.203

@Bridge I understand and thanks for the help. You should be able to post an answer. I think most RDMS's now support recursive CTEs and they were introduced in SQL:1999. So while the syntax may differ slightly I could do this query in postgresql with no issues. – MickyT – 2015-10-09T08:11:33.947

It was the OPTION(MAXRECURSION 0) bit I was unsure about :) – Bridge – 2015-10-09T08:29:47.553

Incidentally, OPTION(MAXRECURSION 0) is MS specific and DB2 doesn't need it so you can shorten a few bytes. – Joshua – 2016-05-14T15:27:44.247

@Joshua Thanks for the pointer, I'll see if I can track down a DB2 instance to test it on. The biggest issue was with tricking the optimizer into allowing it to happen. DB2 may be a bit more sensible than SQL server. – MickyT – 2016-05-15T03:25:44.387

Personally I think default infinite with no stupidity check is in worse taste but oh well. – Joshua – 2016-05-15T04:30:52.583

@Joshua Yep ... no arguments here – MickyT – 2016-05-15T04:35:20.900

3

Rail, 11 bytes

$'main'
@-@

Rail starts at the $ of the main function, heading southeast. We hit -, which makes the train turn and move eastward. After that it's just bouncing all night long between two @ reflectors.

Sp3000

Posted 2015-10-02T17:20:15.947

Reputation: 58 729

3

Insomnia, 2 bytes

HY

It encodes the sequence of instructions: 7289

Although it's not clear whether instruction 8 checks the content of the bit pointer or the group pointer, the code above works in either cases, since the content of the bit or the content of the group is always non-zero.

n̴̖̋h̷͉̃a̷̭̿h̸̡̅ẗ̵̨́d̷̰̀ĥ̷̳

Posted 2015-10-02T17:20:15.947

Reputation: 5 683

3

Ziim, 14 bytes

Encoded in UTF-16. (UTF-8 without BOM is 16 bytes...)

↘↙↙
↑↑

Timwi

Posted 2015-10-02T17:20:15.947

Reputation: 12 158

3

Emmental, 18 11 bytes

;#35#63#!#?

Emmental is a self-modifying, stack-based language. It has no built-in looping operator, so we have to make our own. Here's what the relevant commands mean (taken from the Esolangs wiki page):

  • ; - Push the symbol ; onto the stack.
  • # - Push NUL (ASCII 0) onto the stack.
  • 0..9 - Pop a symbol, multiply its value by 10, add 0..9 respectively, and push the result.
  • ! - Pop a symbol and an Emmental program (a string of symbols terminated by ;). Then redefine that symbol as having the same semantics as that Emmental program.
  • ? Pop a symbol and execute it. This is similar to eval.

So, what does this program (created by @Sp3000) actually do? Well, it redefines NUL to mean #? (push NUL and execute it), then executes NUL. This sets off a domino-like effect where NUL executes NUL executes NUL executes NUL...you get the picture.

I'm no expert on Emmental, but there may be an even shorter way to loop infinitely. Suggestions welcome!

ETHproductions

Posted 2015-10-02T17:20:15.947

Reputation: 47 880

Since you put in the effort to write an explanation, here you go: ;#35#63#!#? – Sp3000 – 2015-10-07T15:33:09.900

@Sp3000 Thanks, that's a clever way to do it! I've updated the answer. – ETHproductions – 2015-10-07T16:00:43.603

3

ArnoldC, 61 bytes

IT'S SHOWTIME
STICK AROUND 1
CHILL
YOU HAVE BEEN TERMINATED

Ironic how the program never actually terminates, even though the last line says "YOU HAVE BEEN TERMINATED."

Mama Fun Roll

Posted 2015-10-02T17:20:15.947

Reputation: 7 234

3

x86 Assembly, 3 Bytes

Inspired by this post

E8 FD FF

is the same as

label: call label

even better, write it to your boot sector to make your computer unbootable faster!

cat

Posted 2015-10-02T17:20:15.947

Reputation: 4 989

This is actually more nefarious than it seems at first since it's actually self-modifying code. Yes, it will eventually create a stack overflow situation and (in at least an unprivileged OS like DOS) replace the entire contents of memory with the return address of the CALL (label + 3 bytes). If say that value is 103H then technically you've just filled the entirety of memory with the instruction ADD AX,[BX+DI] (or ADD [BX+DI],AX) which will then in fact execute infinitely. Cute. – 640KB – 2019-08-21T20:11:09.037

3

Minkolang, 1 byte

A language inspired by space-time has to have at least SOME space! It's also worth noting that this particular 2D infinite loop is unique in that it's actually looping through time. That is, it's falling through the layers (of which there is only 1) of the program, which is toroidal.

El'endia Starman

Posted 2015-10-02T17:20:15.947

Reputation: 14 504

3

Underload, 6 bytes

Directly from the esolangs page.

(:^):^
(:^)     Pushes :^ to the stack.
    :    Duplicates the top of the stack
     ^   Pops the top of the stack and includes it in the command

Try it here using the stepping option to see it working

MickyT

Posted 2015-10-02T17:20:15.947

Reputation: 11 735

Do you mean "top" instead "tope"? – user41805 – 2015-11-05T20:28:39.557

3

PoGo, 4 bytes

pogo

Explanation:

  • po - add current position in code to the top of the po stack
  • go - pop the most recent po location off the stack and jump there

PoGo uses an explicit call stack for flow control, the "po" stack. This code unconditionally jumps back to the beginning, producing an infinite loop. Note that it will not cause a stack overflow, the call stack will never contain more than one element.

Fabian Schmengler

Posted 2015-10-02T17:20:15.947

Reputation: 1 972

3

Aubergine, 6 bytes

:aa=ia

:aa is a no-op. =ia sets the IP to its own location.

LegionMammal978

Posted 2015-10-02T17:20:15.947

Reputation: 15 731

Likewise, aaaiii is the shortest for Purple BUT -i3 is the shortest for UberGenes – quintopia – 2015-12-31T06:53:13.620

3

Quipu, 5 bytes

0&
??

0& pushes 0 as the current strand's value and ?? is an unconditional jump to that strand (which is the strand we're already on).

Martin Ender

Posted 2015-10-02T17:20:15.947

Reputation: 184 808

3

DC, 6 bytes

[dx]dx

...puts the constant string [dx] on the stack, duplicate it (d command), pop and interprete string (x command)...

user19214

Posted 2015-10-02T17:20:15.947

Reputation:

3

Mumps, 1 byte

F

Mumps being a very old language, most of it's commands and operators can be truncated to 1 or 2 letters. The [F]or command with no parameters defaults to an infinite loop until interrupted by a {CTRL}{C}. The flavour of Mumps that I use is InterSystem Caché.

zmerch

Posted 2015-10-02T17:20:15.947

Reputation: 541

3

Subskin, 6 bytes







A series of six newlines. It contains two instructions, both of which set the IP to the second instruction.

LegionMammal978

Posted 2015-10-02T17:20:15.947

Reputation: 15 731

3

Batch, 9 bytes.

a:
goto a

 

ghosts_in_the_code

Posted 2015-10-02T17:20:15.947

Reputation: 2 907

3

Fuzzy Octo Guacamole, 2 bytes

()

A empty infinite loop.

Rɪᴋᴇʀ

Posted 2015-10-02T17:20:15.947

Reputation: 7 410

Can you include a link to the language in the header? – Downgoat – 2016-04-15T01:11:34.480

@Downgoat done. – Rɪᴋᴇʀ – 2016-04-15T01:14:30.657

3

V, 1 byte

ò

V is a 2D string based golfing language that I wrote am in the process of writing, inspired by vim. In vim, recursive macros are a little bit of a pain to set up, so I tried to make them as easy as possible in V. The syntax for a recursive macro is:

ò<code>ò

This is equivalent to

qq<code>@qq@q

in vim.

V will automagically fill in the missing delimiter (in this case, the second ò) so we can leave it off, giving us a nice and simple one-byte solution.

James

Posted 2015-10-02T17:20:15.947

Reputation: 54 537

3

MATL, 3 2 bytes

Quite simple really:

`T

`    # Do ... while
 T   # True
     # Implicit end, normally: ]

Try it online here (Please stop it after testing, don't keep it running).

Stewie Griffin

Posted 2015-10-02T17:20:15.947

Reputation: 43 471

3

evil, 2 bytes

mb

Nothing to see here, just another self-GOTO...

LegionMammal978

Posted 2015-10-02T17:20:15.947

Reputation: 15 731

3

GPRX 3000, 1 byte

g

Sets the IP to the value of register A (which is initially 0).

LegionMammal978

Posted 2015-10-02T17:20:15.947

Reputation: 15 731

3

Seed, 3 bytes

0 0

Equivalent to an empty Befunge program.

George Gibson

Posted 2015-10-02T17:20:15.947

Reputation: 2 369

3

Noobinary, 4 bytes

0000

0000 is a single instruction that jumps to the last 00 (or start of program) if the top of stack is 0.

LegionMammal978

Posted 2015-10-02T17:20:15.947

Reputation: 15 731

3

Barely, 0 bytes



That's right! If the Barely interpreter receives the empty program, then it just hangs. Normally, the code would be terminated with a ~ to separate it from input, so the interpreter keeps reading EOF and never runs anything. Tested on DOSBox v0.74 using input redirection.

LegionMammal978

Posted 2015-10-02T17:20:15.947

Reputation: 15 731

3

Linux shebang, 5 bytes

#!./a

Must be named as a.

Will run out of memory, but this is an infinite loop.

username.ak

Posted 2015-10-02T17:20:15.947

Reputation: 411

1I can't believe nobody's thought of this! +1 – Rɪᴋᴇʀ – 2016-06-08T09:02:59.753

Which system? On Ubuntu exec is a Bash built-in, so I can't specify it as script interpreter. – manatwork – 2016-06-08T09:09:18.730

@manatwork oh, sorry, i forgot that it is built-in. fixed – username.ak – 2016-06-08T09:11:34.747

1Not runs out of memory: “bash: ./a: ./: bad interpreter: Too many levels of symbolic links”. (Though no actual symlink involved.) Well, infinite for 0.001 second. – manatwork – 2016-06-08T12:55:34.930

@manatwork stack overflow auto-detect? – username.ak – 2016-06-08T19:09:02.043

@username.ak https://www.stackoverflow.com

– dkudriavtsev – 2016-07-12T20:31:29.103

1Not working ...bad interpreter... better put ./a alone in the script. If you want to avoid out of memory use ./a& . That's fun if you ps after. That last script will put your computer in a race of creating processes and managing dead processes – Emmanuel – 2016-09-27T22:23:06.530

As PID is changing every time, only solution is to rename the script to end the loop : mv a z – Emmanuel – 2016-09-27T22:27:20.910

3

BASIC, 8 bytes

1 GOTO 1

Goto self

username.ak

Posted 2015-10-02T17:20:15.947

Reputation: 411

3

Brachylog, 2 bytes

=\

Takes no input and no output.

Explanation

= will label the input with an integer. \ is always false and will therefore trigger backtracking. Since the input has no constraints, it will unify as following, through backtracking: 0, then 1, then -1, then 2, etc. This will go on forever.

Fatalize

Posted 2015-10-02T17:20:15.947

Reputation: 32 976

3

Sesos, 2 bytes

0000000: 080a                                              ..

Try it online! Check Debug to see the generated binary code.

How it works

The binary file above has been generated by assembling the following SASM code.

nop       ; Set an entry marker.
    add 1 ; Increment the current cell.
          ; (implicit jnz)
          ;     If the integer in the current cell is non-zero,
          ;     jump to the previous instruction.

Dennis

Posted 2015-10-02T17:20:15.947

Reputation: 196 637

3

Gaot++, 27 bytes

bleeeet bleeeeeet bleeeeeet

bleeeet enters the loop, and bleeeeeet bleeeeeet switches IP direction repeatedly.

LegionMammal978

Posted 2015-10-02T17:20:15.947

Reputation: 15 731

1fun fact: if you're a goat and you say this program you will rotate in a circle forever – Downgoat – 2016-07-26T20:00:36.113

3

Bash or perl, 6 bytes

exec$0

I realize that are both bash solutions and perl solutions this length or shorter, but there are no dual-language solutions. Yup, it runs with either language.

BenGoldberg

Posted 2015-10-02T17:20:15.947

Reputation: 389

Bash answers are always nice to see! Welcome to PPCG. – Steven H. – 2016-09-28T00:40:57.513

3

Bash, 10 2 bytes

$0

Runs the file specified by $0 (i.e. itself). Requires that the script is executable.

Joshua David

Posted 2015-10-02T17:20:15.947

Reputation: 211

2

DUP, 6 bytes

DUP is a dialect of Wouter van Oortmerssen’s FALSE, invented by Ian Osgood.

[1][]#

Explanation:

This uses DUP’s while loop. the first block [1] is the condition block that checks if the condition is true/nonzero, and if it is, executes the second empty block [] that does nothing. The execution block is executed as long as the condition is nonzero.

 [1][]#
 instr.    data stack   return stack
 [        0                         push '[' location
    [     0,3                       push '[' location
      #   0            5,0,3        push '#' and '[' locations on return stack
 [                     
  1       1            5,0,3        push 1 (truthy)
   ][]    0            5,0,3,0      condition true → execute 2nd (empty) block
 [                                  jump to condition block (location 0, popped from the return stack)
  1       1            5,0,3
   ][]    0  ...       5,0,3,0             infinite loop

Just for the fun of it, here is a visually equally long solution that is 8 utf-8 bytes long, but unique to DUP because FALSE lacks this functionality:

[A]⇒AA

Explanation:

         data     return
         stack    stack    operator
[          0                                 push location of open bracket
   ⇒                                         operator assignment to
    A                      A => 0            new operator A (at address 0)
     A                                       execute operator A, push current IP location on return stack
[                 5                          move to operator A at location 0
 A                5,1                        execute operator A, push current IP location on return stack
[                                            move to operator A at location 0
 A                5,1,1                      execute operator A, push current IP location on return stack
...
[
 A                5,1,1,1,1,1,1,1...

As you can see, the latter recursive solution quickly fills the return stack and sooner or later leads to a stack overflow, depending on the available RAM.

A full introduction and explanation of DUP instructions etc. can be found on my GitHub repository or on the pages linked on the online Javascript DUP interpreter webpage.

P.S.: I just noticed that someone already posted a FALSE version. I’m sorry for the duplicate. In this case both languages look the same.

M L

Posted 2015-10-02T17:20:15.947

Reputation: 2 865

2

Scala 12 bytes

while(true)0

Avoid one character using 0 instead of while(true){}

firephil

Posted 2015-10-02T17:20:15.947

Reputation: 211

2

Alice, 0 bytes

Try it online!

The empty program in Alice does nothing... in particular it doesn't terminate.

Martin Ender

Posted 2015-10-02T17:20:15.947

Reputation: 184 808

2

Triangular, 3 bytes

\/<

Triangular is my first attempt at a two-dimensional esoteric language. Code is formatted into the smallest possible triangle - in this case, a triangle of size two. The IP starts moving Southeast from the top of the triangle.

The above code arranges into this triangle:

 \
/ <

Commands:

  • \ direct IP Southeast (towards the <)
  • < direct IP West (towards the /)
  • / direct IP Northeast (towards the \)

MD XF

Posted 2015-10-02T17:20:15.947

Reputation: 11 605

I think you mean a triangle of size two. – Leaky Nun – 2017-06-16T16:51:54.833

@LeakyNun Oh... duh. – MD XF – 2017-06-16T16:52:25.320

2 bytes with ,/ – Reinstate Monica – 2019-06-03T15:52:37.923

2

Thotpatrol, 78 bytes

JACKING IN
  a.txt
REPORT UNPATRIOTIC ACTIVITY

A simple self recursive program that points the interpreter to call itself recursively. The assumption is that the program is in a file called "a.txt" The call is embedded in a try statement to suppress stack overflow warning. The structure is as follows:

function a:
    try a

Link to implementation: https://github.com/MindyGalveston/thotpatrol-

Mr. Negi

Posted 2015-10-02T17:20:15.947

Reputation: 75

2

Brain-Flak, 8 bytes

(()){()}

Explanation: 

(())   - Puts one on the top of the stack
{  }   - Runs until the top of the stack is zero
 ()    - Filler so that the above function runs

Try it online!

FantaC

Posted 2015-10-02T17:20:15.947

Reputation: 1 425

2

Piet, 2 codels

Can be interpreted and executed using, for example, PietDev, by either

  • setting the canvas' width to 2, height to 1 and coloring the codels yourself or
  • clicking on "Open", setting the codel width to 25 and uploading the above image.

Click the step button repeatedly to see the program rotate and loop or the run button to freeze the page.

Edit: Try It Online

Edit 2: Just saw that someone already beat me to it.

user72779

Posted 2015-10-02T17:20:15.947

Reputation:

2

Commodore BASIC V2 (Commodore 64/VIC-20), 6 tokenized BASIC bytes

 0 GOTO

or to save some typing (not actual bytes):

 0G[shift]O

which uses the keyword abbreviation for GOTO (may also be typed as GO TO)

In Commodore BASIC V2, GOTO assumes GOTO 0. Byte count is determined from PRINT FRE(0) on VIC-20, default value is 3581.

Shaun Bebbers

Posted 2015-10-02T17:20:15.947

Reputation: 1 814

2

C (tcc), x86_64, 10 bytes

main=-277;

Try it online!

How it works

This writes the int -277 (ebfeffff in little endian) to the memory location of main.

eb is JMP and is to be followed by a signed 8-bit address indicating where to jump to. fe is -2, so we jump back to eb and start over.

Dennis

Posted 2015-10-02T17:20:15.947

Reputation: 196 637

2

beeswax, 3 bytes

O_O

or alternatively

j_j

or

>_<

All three create two bees that get reflected back and forth indefinitely.

M L

Posted 2015-10-02T17:20:15.947

Reputation: 2 865

2

Z80 Machine Code, 1 Byte

0x76

Halt

When a software HALT instruction is executed, the CPU executes NOPs until an interrupt is received (either a nonmaskable or a maskable interrupt while the interrupt flip-flop is enabled)..

mazzy

Posted 2015-10-02T17:20:15.947

Reputation: 4 832

Welcome to PPCG! Btw, if you want to improve existing answers, just leave a comment with your shorter version. – ovs – 2018-06-04T09:43:32.010

Thanks. I have not found answer with Halt for Z80. I'm not sure that this answer with reset is correct for this challange

– mazzy – 2018-06-04T09:52:15.463

Oh, I actually meant this unrelated answer which you tried to edit

– ovs – 2018-06-04T09:55:06.583

got it. thanks. – mazzy – 2018-06-04T10:00:48.657

2

Pepe, 6 bytes

REEReE

Try it online!

Begin loop, end loop. No need to explain it much.

Also, for fun: REE ReE reeE makes the permalink #FBI.

RedClover

Posted 2015-10-02T17:20:15.947

Reputation: 719

2

Shakespeare Programming Language, 61 bytes

,.Ajax,.Act I:.Scene I:.[Exeunt][Enter Ajax]Ajax:Let usAct I.

Try it online!

It's totally legal to only ever use one character in a play; just don't make him do anything other than loop the program forever, exiting and entering the stage constantly.

JosiahRyanW

Posted 2015-10-02T17:20:15.947

Reputation: 2 600

2

Keg, 1 byte

{

Auto completes the while loop and runs it infinitely

Lyxal

Posted 2015-10-02T17:20:15.947

Reputation: 5 253

2

Pyramid Scheme, 41 bytes

   ^
  / \
 /do \
^-----^
-^    -
/1\
---

Try it online!

Almost a straight translation of @JoshuaTaylor's Lisp ten-byter.

Khuldraeseth na'Barya

Posted 2015-10-02T17:20:15.947

Reputation: 2 608

2

PHP, 12 bytes

Different answers are posted for PHP which use loops or labels, but here is one which doesn't use any of them. Save the file with a single character name and then include itself. For example if you save the file as 1:

<?include 1;

Run with: php -n 1, this will go on until PHP goes out of memory or max execution time reaches.

Night2

Posted 2015-10-02T17:20:15.947

Reputation: 5 484

2

Retina, 10 bytes

I'm pretty sure this can be made shorter.


0
+T`d`10

TheNumberOne

Posted 2015-10-02T17:20:15.947

Reputation: 10 855

Can't you just do + followed by nothing? – kirbyfan64sos – 2015-10-02T19:06:45.593

@kirbyfan64sos + loops until the input no longer changes. – TheNumberOne – 2015-10-02T19:07:19.767

I know. But, if you're replacing nothing with nothing, the input will never change, right? – kirbyfan64sos – 2015-10-02T19:08:13.053

Ah, nevermind. I was thinking backwards. – kirbyfan64sos – 2015-10-02T19:09:33.630

@kirbyfan64sos Exactly; therefore it would only loop once. – TheNumberOne – 2015-10-02T19:09:40.313

While you guys were discussing this, I posted a working solution based on a similar idea.

– Martin Ender – 2015-10-02T19:11:52.073

@MartinBüttner the pessimist says the glass is half empty. The optimist says it's half full. While the two are arguing, the opportunist drinks it. – Cyoce – 2016-04-17T00:32:30.710

@Cyoce Does that mean I'm the pessimist :P – TheNumberOne – 2016-04-17T22:40:09.010

@TheNumberOne I'm afraid that yes, you are the pessimist!! – Erik the Outgolfer – 2016-09-10T10:54:36.307

2

GNU sed, 3 bytes

:;b

Using this meta answer as justification for the relaxation of the no-input rule.

: defines a (nameless) label, ; is a line/command separator, b jumps to the label.

Nameless labels seems to be a GNU extension.

Digital Trauma

Posted 2015-10-02T17:20:15.947

Reputation: 64 644

1

Nameless labels seems to be a bug.

– Ben – 2015-10-02T20:33:32.907

3@Ben From your link "Not really a bug as such" - I prefer "undocumented feature" ;-) Fair game for codegolf, IMO... Don't use it in production code though. – Digital Trauma – 2015-10-02T20:42:56.917

2

Spin, 13 Bytes

File x.spin:

pub x
 repeat

(without trailing newline)

Compile and download it to your P8x32a microcontroller or run it using spinsim.

user19214

Posted 2015-10-02T17:20:15.947

Reputation:

2

Scala, 12 bytes

while(1>0){}

Ben

Posted 2015-10-02T17:20:15.947

Reputation: 360

2

R, 9 8 bytes

repeat 1

Saved 1 byte thanks to MickyT!

Alex A.

Posted 2015-10-02T17:20:15.947

Reputation: 23 761

You can use repeat 1 for 1 byte saving. – MickyT – 2015-10-02T20:24:10.140

@MickyT Nice, I always forget about repeat. Thanks! – Alex A. – 2015-10-02T20:26:51.747

2

AutoIt3, 12 bytes

While 1
WEnd

Simply loop indefinitely. Nothing much to say.

GiantTree

Posted 2015-10-02T17:20:15.947

Reputation: 885

2

BBC Basic for Windows, 3 or 6

http://www.bbcbasic.co.uk/bbcwin/bbcwin.html

RUN

3 ASCII characters. Note in this version of BBC basic line numbers are not required.

If you don't consider termination and self-execution a loop, then the shortest program is

1GOTO1

6 ASCII characters.

One might expect these to be shorter in the tokenized version (1 byte per keyword), but it seems they are not, due to the way line numbers / internal ID's are stored.

Level River St

Posted 2015-10-02T17:20:15.947

Reputation: 22 049

Why not 1G.1? – Neil – 2015-10-03T20:44:52.263

2

Groovy, 8 bytes

for(;;);

Shortened from the original thanks to suggestions. The trailing semicolon is still required, unfortunately.

while(1){}

Mike Clark

Posted 2015-10-02T17:20:15.947

Reputation: 171

Can you not just do while(1); do you have to use {} ? – Albert Renshaw – 2015-10-03T06:04:17.877

for(;;); <--what about that, I'm not familiar with Groovy – Albert Renshaw – 2015-10-03T06:04:41.703

2

Math++, 3 bytes

1>$

Basically a GOTO 1 statement- on line 1.

SuperJedi224

Posted 2015-10-02T17:20:15.947

Reputation: 11 342

2

Microscript, 2 bytes

1{

Essentially just n=1;while(n!=0){}. The interpreter autocloses any loops, etc. that are left open.

The Microscript II program 1[ is equivalent.

SuperJedi224

Posted 2015-10-02T17:20:15.947

Reputation: 11 342

2

OCaml, 17 bytes

while 1<2do()done

1 byte removed thanks to @Mauris.

Another one bytes the dust thanks to @feersum.

coredump

Posted 2015-10-02T17:20:15.947

Reputation: 6 292

1Try 1<2 instead of true. – Lynn – 2015-10-11T09:06:39.717

@Mauris Nice catch, thanks – coredump – 2015-10-11T09:11:26.343

1You can drop the space after 2. – feersum – 2015-10-15T19:40:36.330

2

Julia, 13 12 bytes

while 1<2end

Yawn. I tried a map and a for loop, but to no avail...

EDIT: Someone pointed out that I could shorten the program by removing parentheses. Thanks!

Alternatively, if stack-overflowing infinite recursion counts as infinite (11 bytes):

i()=i();i()

eaglgenes101

Posted 2015-10-02T17:20:15.947

Reputation: 577

You don't need the parentheses around 1<2 (in fact it's rather "un-Julian" to have them there). – Alex A. – 2015-10-02T21:24:26.037

Why isn't 1 True, or why isn't 1<2 1? (That is, why doesn't Juila implement bool as a "subclass" of int, like Python does, which is endlessly useful?) – cat – 2016-03-19T18:38:15.930

2

Self-modifying Brainfuck, 3 bytes

Same effect as in regular BF. Increment the cell and loop forever. -[] is the same.

+[]

Since the source code in placed on the tape, this is also acceptable, and only works in SMBF:

<[]

If the tape were actually infinite, [ or ] would work, since the interpreter would search for the matching bracket forever. Unfortunately (fortunately?), you just get an "index out of bounds" error.

mbomb007

Posted 2015-10-02T17:20:15.947

Reputation: 21 944

2

Forth, 21 bytes

Unfortunately, you can't make a word that calls itself without using the keyword recursive, so I use a standard infinite loop instead.

: f begin 0 until ; f

Try it online

mbomb007

Posted 2015-10-02T17:20:15.947

Reputation: 21 944

Errors with stack overflow on gforth. What did you test this on? – NieDzejkob – 2018-03-06T14:20:22.943

2

AutoIt, 10 bytes

Do
Until 0

Lame.

mınxomaτ

Posted 2015-10-02T17:20:15.947

Reputation: 7 398

AutoIt was my first programming language and this solution is good as well... So Plus One! :) – Arjun – 2016-05-12T10:34:20.053

2

ferNANDo, 7 bytes

1 1
1
1

Line 1 initializes 1 to 1, line 2 marks the beginning of the loop, and line 3 marks the end (a single variable statement loops back to the previous occurrence, if any, for as long as the variable is true).

primo

Posted 2015-10-02T17:20:15.947

Reputation: 30 891

2

StackStream, 21 bytes

{ dup exec } dup exec

Kind-of explanation thingy:

{ dup exec } # Push this piece of code onto the data stack.
dup # Duplicate it (stack: { dup exec } { dup exec })
exec # Execute it (stack: { dup exec })

puckipedia

Posted 2015-10-02T17:20:15.947

Reputation: 199

Oh, someone else made a badly-parsed stack-based language? Yay! – CalculatorFeline – 2016-03-20T02:18:49.933

2

gs2, 2 bytes

CP437: ►3

Hex dump: 10 33

Tries to split whatever is on STDIN into chunks of length 0. We never actually split off any chunks, not even from an empty string, so this takes forever.

Note that gs2 doesn't have any traditional looping constructs.

(Mitch Schwartz found this and told me about it, and I thought it was a really cute feature.)

Lynn

Posted 2015-10-02T17:20:15.947

Reputation: 55 648

What GS2 version is this? It immediately stops on the current version for me – LegionMammal978 – 2016-09-22T00:41:29.653

2

Burlesque, 2 bytes

bc

The BoxCycle command. Essentially takes whatever string s is on STDIN and tries to evaluate the infinite list [s, s, s...]

Lynn

Posted 2015-10-02T17:20:15.947

Reputation: 55 648

2

Whitespace, 9 bytes

;
...; create label [space]
;
.;
.    goto label [space]

. represents a space and ; represents a newline character.

Somo145

Posted 2015-10-02T17:20:15.947

Reputation: 121

I know it's been almost three years, but you're currently code is actually 10 bytes, because it needs a trailing new-line for the "Goto Label". But you can golf it to 8 bytes by using an empty label instead of a Space-label: NSSN and NSNN. Try it online raw or try it online with highlighting an explanation.

– Kevin Cruijssen – 2018-06-04T09:29:54.677

2

RoboTalk, 5 bytes

0 rti

RoboTalk has three "goto" instructions: jump, return, and rti. Jump and return are plain "go to the address on the top of the stack" instructions, while rti has the side effect of (re-)enabling interrupts, as it's intended to be used to exit interrupt handlers. In a robot without any interrupt handlers defined, however, it is functionally equivalent to the other two instructions while being one byte shorter than jump.

Mark

Posted 2015-10-02T17:20:15.947

Reputation: 2 099

2

FlogScript, 2 bytes

F<

The F< (flow-control-restart) command repeatedly restarts the program.

Lynn

Posted 2015-10-02T17:20:15.947

Reputation: 55 648

2

8085 Intel Microprocessor ,4 1 byte

0000h: pchl

whose machine code is:

E9

Just reset the microprocessor. And load E9 at 0000h.

p.s: its almost impossible in some kit to load program at ROM memory(which is basically the start memory) So, it works on simulator and some special kits only.

C000H: lxi h,C000h
C003H: pchl

whose machine code will be

21 00 0C E9 

loaded in memory from C000H

Kishan Kumar

Posted 2015-10-02T17:20:15.947

Reputation: 427

2

Factor, 14 bytes

: a ( -- ) a ;

and nicely symmetrical looking (almost)

user29119

Posted 2015-10-02T17:20:15.947

Reputation: 61

2

Pyth, 3 bytes

W1 

Note that there is a space after W1.

Grant Davis

Posted 2015-10-02T17:20:15.947

Reputation: 693

2

Burlesque, 5 bytes

0bc<-

Trying to reverse an infinite list is guaranteed to loop forever and since it loops forever no output will be produced ever.

mroman

Posted 2015-10-02T17:20:15.947

Reputation: 1 382

2

PowerShell, 14 7 Bytes

for(){}

Previous version (14 bytes):

while($true){}

Chad Baxter

Posted 2015-10-02T17:20:15.947

Reputation: 248

I didn't notice this until today because I got an upvote, but I posted this exact answer earlier in the same same month: http://codegolf.stackexchange.com/a/59429/30402

– briantist – 2016-05-14T18:41:20.487

2

Roadrunner, 14 bytes

mEEp mEEP MEEp

Zach Gates

Posted 2015-10-02T17:20:15.947

Reputation: 6 152

2

Seriously 0.1, 2 bytes

1W

1 pushes a 1 on the stack, W executes the code between it and the next W (or EOF) while the value on the top of the stack is a truthy value. Since the value on top of the stack stays 1, it NOPs forever.

Mego

Posted 2015-10-02T17:20:15.947

Reputation: 32 998

2

BotEngine, 2 bytes

><

Fairly self-explanatory.

SuperJedi224

Posted 2015-10-02T17:20:15.947

Reputation: 11 342

do bots loop around? if so, you could just do > – anOKsquirrel – 2015-11-12T23:34:52.773

@anOKsquirrel No, they unfortunately do not. As stated in the specs, bots are destroyed upon exiting the grid. – SuperJedi224 – 2015-11-12T23:35:29.210

ah, I see. better read more – anOKsquirrel – 2015-11-12T23:47:06.610

2

Marbelous, 7 bytes

00
\\//

One marble bounces between the two deflectors forever.

Alternate version:

00
/\/\

Sparr

Posted 2015-10-02T17:20:15.947

Reputation: 5 758

What about simply MB ? – overactor – 2015-12-07T09:32:33.927

@overactor I've been meaning to change the language spec so zero-input boards don't proc every tick and instead wait for one input which they discard. That's a much more useful construct. Regardless, even with the old spec, MB would infinitely recurse, not loop. – Sparr – 2015-12-07T19:18:10.283

2

Javascript, 8 bytes

while();

This almost crashed my computer once :o

ev3commander

Posted 2015-10-02T17:20:15.947

Reputation: 1 187

Wait... this works? How? – SuperJedi224 – 2015-11-28T17:04:38.897

I don't know... – ev3commander – 2015-11-28T17:05:07.883

Where does it work? – Qwertiy – 2015-12-14T21:32:30.233

@Qwertiy chrome – ev3commander – 2015-12-14T21:36:07.537

1Nope: Uncaught SyntaxError: Unexpected token )(…) – Qwertiy – 2015-12-14T21:36:38.827

Huh... it worked before... – ev3commander – 2015-12-15T01:38:02.037

2

Mouse-2002, 2 bytes

()

( begins a loop; ) ends it; there's no ^ so it never breaks.

cat

Posted 2015-10-02T17:20:15.947

Reputation: 4 989

1Lol, cat and mouse :) – user41805 – 2015-12-14T13:57:18.323

I think it's pretty great that I have the nickname cat, and am working on rebooting a language called mouse :) – cat – 2015-12-14T14:15:03.103

2

QBasic, 8 7 bytes

DO:LOOP

Even shorter than the GOTO one!


V1.0

1:GOTO 1

Classical Goto.

steenbergh

Posted 2015-10-02T17:20:15.947

Reputation: 7 772

2

QBIC, 2 bytes

{}

This compiles into QBasic as DO: LOOP.


Note that not long after answering this challenge, the workings of QBIC has been altered. We now see IF, DO and FOR as 'language constructs': an opening statement, <code goes here> and a closing statement. Note that WHILE/WEND, functions and subs could also be supported as language constructs in the future.

Those currently supported by QBIC (IF, FOR and DO) are opened using ~, [ and { respectively. Closing them can be done with either a ] or a }: these mean 'Close the last language construct' and 'Close all constructs'.

QBIC has had the ability to auto-close language constructs for some time now. The above code could be one byte only: {. The final statement that QBIC adds to its own source is a } to close all constructs.

steenbergh

Posted 2015-10-02T17:20:15.947

Reputation: 7 772

2

beeswax, 3 or 4 bytes

A real loop (4 byte solution)

*PFJ

Explanation:

* Generate IP, moving to the right.                      [0,0,0]•
P Increment top local stack value.                       [0,0,1]•
F Set all local stack values to top local stack value.   [1,1,1]•
J Jump to [row,column] = [top,2nd] local stack values.   [1,1,1]•
  IP jumps back to to the *

Shorter 3 byte solution

I am not sure if reflecting IPs back and forth counts as loop, but here it is:

j*j

Explanation:

j Mirror IP in horizontal direction
* Create IP

So, this program creates two IPs moving to the right and the left, which are reflected back between both j’s indefinitely.

M L

Posted 2015-10-02T17:20:15.947

Reputation: 2 865

2I suggest you use the 3 byte solution. – user41805 – 2015-12-26T07:35:58.787

2

Spiral, 1 byte

0

All programs start at the label 0. All programs halt at the command !. Self-explanatory.

quintopia

Posted 2015-10-02T17:20:15.947

Reputation: 3 899

2

Mouse16, 2 bytes

I hereby release the language I've been teasing!

0\

Goes to zero... which is the first byte... which executes the \ goto again... which -- well, you get the idea. This is like 10 GOTO 10 in BASIC.

cat

Posted 2015-10-02T17:20:15.947

Reputation: 4 989

2

Lua, 14 bytes

repeat until a

or

while 1 do end

The first one works because a is nil (because it is undefined), so it will never be true. The second one works because anything that is not false or nil, when casted to a boolean, evaluates to true.

Not boring version, 23 bytes

debug.getinfo(1).func()

debug.getinfo(1) returns the debug information of the current stack, and the func property represents a function that executes that stack. This will call the main stack an infinite amount of times.

QuertyKeyboard

Posted 2015-10-02T17:20:15.947

Reputation: 71

1Will any of these eventually overflow? – cat – 2016-01-31T05:08:44.190

1

@cat I don't think they will. I tested all of them online on this demo and it didn't overflow, or put anything in the output for that matter.

– QuertyKeyboard – 2016-01-31T16:18:07.457

I just tested on lua5.2.4 and the first two occupy 100% of a core but 0.0% memory and so will never overflow, while the last one crashes with a stackoverflow in a few seconds after eating 20% of memory each second. – cat – 2016-01-31T16:35:07.227

Having said that, debug.getinfo(1).func() on lua5.3 behaves exactly like the other two do. – cat – 2016-01-31T16:37:11.273

1That's good to know, I actually didn't know it overflows on earlier versions of lua. Thanks for letting me know. – QuertyKeyboard – 2016-01-31T18:20:04.943

2

2-ill, 7 bytes

@ @
@$@

The instruction pointer just loops counterclockwise forever.

LegionMammal978

Posted 2015-10-02T17:20:15.947

Reputation: 15 731

2

Perl, 6 bytes

{redo}

See redo in perldoc.

Grimmy

Posted 2015-10-02T17:20:15.947

Reputation: 12 521

2

T-SQL, 8 bytes

l:goto l

(Not to be confused with this excellent answer from @MickyT in Standard SQL)

S.Karras

Posted 2015-10-02T17:20:15.947

Reputation: 241

2

S.I.L.O.S, 11 bytes

lbla
GOTO a

betseg

Posted 2015-10-02T17:20:15.947

Reputation: 8 493

2

Turtlèd, 3 bytes

any character but * works in the middle

[-]

alt:

{*}

Explanation:

[    ] Brackets make a while loop. The character after the opening bracket is taken, and
       the loop is executed while the current cell is not that character.

hence

[-]

Runs whilst the current cell is not -, but will never change it to that value, so infinitely runs, and never ouputs as it only outputs at the end.


{*}

works similarly, but it runs while the current cell IS that value. by default, the starting cell is *, so it runs forever, since it will never change its value

(nontrivial) Polyglot, Turtlèd and Brainf*** 5 or 4 bytes, depending on implementation

doesn't make use of BF non instruction nops.

If you happen to have another cool esolang that might be able to be fitted in, tell me.

+[-+]

In wrapping implementations,

in non-wrapping:

+[+]

Explanation:

+    - essentially a nop in Turtlèd with no string, increments cell in BF
 [+] - loops while current cell is not: {BF:0, Turtlèd:"+"}. increments cell in BF

 [+-] - loops while current cell is not {BF:0, Turtlèd:"+"}. - is nop in Turtlèd with 
        no string, and `+-` together is nop (+1,-1) in BF 

Destructible Lemon

Posted 2015-10-02T17:20:15.947

Reputation: 5 908

2

S.I.L.O.S, 9 bytes

:a
GOTO a

Try it online!

acrolith

Posted 2015-10-02T17:20:15.947

Reputation: 3 728

2

J, 7 Bytes

(-^:_)_

A more "readable" form would be (- ^: _) 1. The _ can be any non-zero number and it will work the same (_ represents infinity in J). ^: is the "power" conjunction; it iterates a verb a specified number of times. E.g. (f ^: 3) 0 == f(f(f(0))). When told to iterate _ times, it keeps applying until it produces a constant output. Since negation never reaches a limit, this is an infinite loop.

Cyoce

Posted 2015-10-02T17:20:15.947

Reputation: 2 690

2

PHP, 8 26 bytes

set_time_limit(0);for(;;);

Almost forgot: default time limit is 30 seconds and script will exit with a Fatal Error if I don´t unset it.

Run with -r

Titus

Posted 2015-10-02T17:20:15.947

Reputation: 13 814

2

05AB1E, 2 bytes

[[

Try it online!

Explanation:

[     # Infinite loop start
 [    # Infinite loop start
      # Implicit infinite loop end
      # Implicit infinite loop end

You need something inside the infinite loop, or else it will just end

Oliver Ni

Posted 2015-10-02T17:20:15.947

Reputation: 9 650

You don't need anything inside if you close it with ], but it's still 2 bytes ([]). – Erik the Outgolfer – 2016-11-12T10:35:23.907

1

Lithp, 40 bytes

((platform ext)(invoke (stdin) resume))

There are presently no loop constructs in my language. Instead, we tell NodeJS (in which Lithp is implemented) to resume the process.stdin stream. We haven't setup a handler, but the process will never exit.

In fact, you have to send a kill message to abort the application.

Andrakis

Posted 2015-10-02T17:20:15.947

Reputation: 361

1

PHP, 9 bytes

back to basic:

L:goto L;

^_^

Titus

Posted 2015-10-02T17:20:15.947

Reputation: 13 814

1

Clojure, 21 10 bytes

(#(recur))

After posting a question of meta regarding what's considered a full program in Clojure, it seems that the above is acceptable. If you paste it in an empty source file, it will run.

Carcigenicate

Posted 2015-10-02T17:20:15.947

Reputation: 3 295

1

TI-83 Hex Assembly, 3 bytes

PROGRAM:L
:AsmPrgm
:C3959D

Run it with Asm(prgmL). Jumps to itself over and over. The only way to stop the program is to physically remove the batteries from the calculator. I count each pair of hex digits as one byte.

Harry

Posted 2015-10-02T17:20:15.947

Reputation: 1 189

1

Pushy, 2 1 bytes

[

Try it online!

Hah, [ is just an infinite loop, that's its only function if you see here.

user41805

Posted 2015-10-02T17:20:15.947

Reputation: 16 320

1

FALSE, 6 bytes

[1][]#

This is a while loop (#) with an empty body function ([]) and a condition function that always yields a truthy value. It runs forever without yielding output.

Interpreter used.

Conor O'Brien

Posted 2015-10-02T17:20:15.947

Reputation: 36 228

1

Lithp, 27 bytes

 ((def x #::((next x)))(x))

Define a function, x, which uses tail recursion (via next) to call itself. Then call function x.

This program will never finish. You can't even CTRL+C out of it since keyboard input isn't handled in Node.js whilst in a while loop.

If one were to provide the -d flag to run.js, they would see the function calling itself over and over, never finishing nor running out of stack space.

This was a neat feature to get working in my language. Typically one would use some sort of logic flow to determine whether to return a value or tail recurse back into the current function (using next or recurse.)

The implementation of such tail recursion was fairly simple, but its implications in my functional language are great. My feature set is getting nearer and nearer to Erlang's every week. And that's fun.

Andrakis

Posted 2015-10-02T17:20:15.947

Reputation: 361

1

tinylisp, 13 bytes

((v(d f(q(L(f

Parenthesis autocompletion really helps!

We define a function f that calls itself using tail-call recursion. Functions in tinylisp are lists containing two elements: parameter list and expression. Here, our parameter list is L (which makes this a variadic function: L is bound to a list of all arguments) and our expression is (f) (calling the function with no arguments).

((v(d f(q(L(f))))))
         (L(f))      The function list
       (q      )     Quoted to prevent evaluation
   (d f         )    Define f to be that list
 (v              )   The d call returns the name f; evaluate it to get the function itself
(                 )  Call the function

Use Ctrl-C to halt execution.

DLosc

Posted 2015-10-02T17:20:15.947

Reputation: 21 213

1

uBASIC, 7 bytes

1GOTO1

Note trailing newline. Trivial BASIC variant.

Try it online!

Pavel

Posted 2015-10-02T17:20:15.947

Reputation: 8 585

1

Excel VBA, 7 Bytes

Do:Loop

Note: the above freezes Excel - the shortest Excel VBA loop that does not do this is Do:DoEvents:Loop (16 Bytes)

Taylor Scott

Posted 2015-10-02T17:20:15.947

Reputation: 6 709

1

GNU Sed, 3 bytes

Unlike this answer by @Digital Trauma (which relies on bug #21250: sed: empty label for :/b/t commands), does only use documented Sed commands, in the same byte count.

Golfed

G 
D

Explained

G       #Append a newline to the contents of the pattern 
        #space, and then append the contents of the hold
        #space to that of the pattern space.

D       #Delete text in the pattern space up to the 
        #first newline, and restart cycle with the 
        #resultant pattern space, without reading a new 
        #line of input.

zeppelin

Posted 2015-10-02T17:20:15.947

Reputation: 7 884

1

x86 Assembly, 2 bytes

x: loop x

Bytes: Ô■

Hex: ['0xe2', '0xfe']

z0rberg's

Posted 2015-10-02T17:20:15.947

Reputation: 409

1This will not produce an infinite loop. As soon as CX is 1 it will stop looping. – 640KB – 2019-08-21T19:43:42.783

1

tcl, 7 bytes

vwait v

Explanation

sergiol

Posted 2015-10-02T17:20:15.947

Reputation: 3 055

1

Ruby w/J-uby, 5 bytes

:~!~0

J-uby is all about making procs (i.e., anonymous functions/lambdas) work more concisely in Ruby. It allows symbols to be called like procs without a call to to_proc. Additionally, it adds a lot of functionality to procs. The added functionality we are using here is !~, or "iterate until constant". Basically, it takes a proc and an initial argument, and applies that proc to the argument until the application stops changing the argument (f.(x) == x). So we are calling ~ (bitwise negation) on 0 until they are equal. But due to the nature of bitwise negation (~x != x, ~~x == x for all x), this never occurs. Infinite loop.

7 bytes:

~:^^~:^

A more "readable" form would be (~:^) ^ (~:^). In J-uby, :^ is the call function; f^x == f[x]. The ~ operation turns a two-argument function into a one-argument function which applies the given argument to both sides. So (~:^)^x == x^x. Finally, we apply this to both sides by turning these into lambdas and we get: ->(x){ x ^ x } ^ ->(x){ x ^ x }. This is analogous to (x => x(x))(x => x(x)) in JavaScript, (\x->x x)(\x->x x) in Haskell, or (λx.xx)(λx.xx) in Lambda Calculus.

Cyoce

Posted 2015-10-02T17:20:15.947

Reputation: 2 690

1

Forte, 4 bytes

1REM

Without an END statement, Forte programs loop infinitely. The empty program is an error, so we leave a comment.

Try it online!

Pavel

Posted 2015-10-02T17:20:15.947

Reputation: 8 585

Nice job understanding Forte (even if all you did was write 4 characters in it) – Esolanging Fruit – 2017-07-10T00:06:25.130

1

OIL, 1 byte

6

TIO does not currently support OIL.

Explanation:

6 // Jump to cell A.
0 // Implicit 0.

Erik the Outgolfer

Posted 2015-10-02T17:20:15.947

Reputation: 38 134

1

Lua and RBX.Lua, 14 bytes

while 1 do end

Pretty self explanatory. While 1 is true, it will iterate through the loop.

Josh

Posted 2015-10-02T17:20:15.947

Reputation: 1 021

1

Decimal, 6 bytes

91D91D

Pretty simple:

91D   ; declare jump 1
91D   ; goto jump 1

Try it online! I mean, not exactly try it, but... you know what I mean.

MD XF

Posted 2015-10-02T17:20:15.947

Reputation: 11 605

1

Braingolf, 4 bytes

[1+]

Try it online!

Skidsdev

Posted 2015-10-02T17:20:15.947

Reputation: 9 656

1

Fission 2, 1 byte

R

Try it online!

Spawns an atom moving right, wraps on the end of the line, R simply sets the atom's direction to right after the program has started

Skidsdev

Posted 2015-10-02T17:20:15.947

Reputation: 9 656

1

Aceto, 1 byte

O

O jumps to the origin of the script. Alternative solutions: Any of v^<>NSEW;§j@

L3viathan

Posted 2015-10-02T17:20:15.947

Reputation: 3 151

1

Lean Mean Bean Machine, 3 bytes

O
~

Marble spawns at O, drops to ~, which teleports it back up to the top of the column.

Skidsdev

Posted 2015-10-02T17:20:15.947

Reputation: 9 656

1

Taxi, 22 bytes

[a]Switch to plan "a".

Try it online!

Not very exciting. TIO will only run it for 60 seconds before timing out.

Engineer Toast

Posted 2015-10-02T17:20:15.947

Reputation: 5 769

1

Emojicode, 28 bytes


betseg

Posted 2015-10-02T17:20:15.947

Reputation: 8 493

1

Java, 23 bytes

enum L{L;L(){for(;;);}}

Works with Java 5 and 6. Not with later versions, not with earlier versions. Just another variation of my "Hello, World!" answer.

Proof of correctness

$ java -version
java version "1.6.0_45"
Java(TM) SE Runtime Environment (build 1.6.0_45-b06)
Java HotSpot(TM) 64-Bit Server VM (build 20.45-b01, mixed mode)
$ cat L.java
enum L{L;L(){for(;;);}}
$ javac L.java
$ java L

Then it hangs.

Olivier Grégoire

Posted 2015-10-02T17:20:15.947

Reputation: 10 647

1

JavaScript, 9 bytes

while(1);

Infinite while loop using 1 as a true value

xDest

Posted 2015-10-02T17:20:15.947

Reputation: 31

It seems I have been beaten by 1 byte – xDest – 2017-11-10T20:44:54.110

1

Java (OpenJDK 8), 50 bytes

interface J{static void main(String[]a){for(;;);}}

Try it online!

Since Java 8 interfaces can have method bodies. As they are always public, we save 3 bytes.

Luca H

Posted 2015-10-02T17:20:15.947

Reputation: 163

1

Z80, 2 bytes [non competitive, late entry]

18 FE

Assembly

JR -2

or

LOOP JR LOOP

Note: JR is a relative jump (hex code 18), followed by a signed 8-bit number. It changes the program counter by that number; that happens after the whole command (2 bytes) has been red and program counter increased to point at the instruction immediately after. JR 0 would then just have no effect (a 2 byte version of NOP).

Heimdall

Posted 2015-10-02T17:20:15.947

Reputation: 191

1

Husk, 2 bytes

ƒI

Try it online!

Explanation

This is the Haskell equivalent of the following

fix :: (a -> a) -> a
fix f = f $ fix f

fix id

where ƒ is fix and I the identity function (id).

ბიმო

Posted 2015-10-02T17:20:15.947

Reputation: 15 345

achieves the same. – ბიმო – 2017-12-03T01:01:06.567

1

Aceto, 1 byte

O
O jumps back to the origin, which conveniently is where the O is!

Try it online!

I didn't see @L3viathan's post so...

Some multi-byte solutions

  • @1$
  • 1§uu
  • 1§##

  • 3§ _
    | |
    _

Try It Online!

FantaC

Posted 2015-10-02T17:20:15.947

Reputation: 1 425

1

SNOBOL4 (CSNOBOL4), 10 bytes

L	:(L)
END

Try it online!

Line L is just a goto L, which works perfectly.

Giuseppe

Posted 2015-10-02T17:20:15.947

Reputation: 21 077

1

Swift, 11 bytes

while 0<1{}

Works both compiled and as a shell script.

Dan Karbayev

Posted 2015-10-02T17:20:15.947

Reputation: 111

Welcome to PPCG! – 0 ' – 2018-02-12T10:53:08.633

Thanks, @0 '! I'm starting to explore CG-possibilities in Swift despite of its annoying "Expression is too complex" :) – Dan Karbayev – 2018-02-13T11:26:15.240

1

Clojure, 9 bytes (old 15 bytes) thank to @Dennins

(while 1)

NTCG

Posted 2015-10-02T17:20:15.947

Reputation: 151

1

A simple (while 1) would work as well. Try it online!

– Dennis – 2018-02-13T02:51:11.557

@Dennins, upvoted – NTCG – 2018-02-13T03:08:50.200

1That was intended as a golfing suggestion; feel free to edit it into your post. – Dennis – 2018-02-13T03:33:47.823

1

Javascript, 8 bytes

for(;;);

An empty for with no condition does the trick.

Stefan Octavian

Posted 2015-10-02T17:20:15.947

Reputation: 119

1Welcome to PPCG! – Martin Ender – 2018-03-01T16:21:58.627

1

Welcome. There already exists an existing answer with the same code, see here. You can check the leaderboard snippet out to see which languages already have answers.

– user41805 – 2018-04-14T19:16:54.440

1

ORK, 132 bytes

There is such a thing as a y.
A y can z.

When a y is to z:
I am to loop.

When this program starts:
I have a y called X.
X is to z.

Try it online!

Defines a class y with a member function z that does nothing but loop. Then instantiates y and calls its z function.

DLosc

Posted 2015-10-02T17:20:15.947

Reputation: 21 213

1

VBA 7 Bytes

Do
Loop

I like VBA; it does exactly what you tell it

Absinthe

Posted 2015-10-02T17:20:15.947

Reputation: 499

1

Muhammad Salman

Posted 2015-10-02T17:20:15.947

Reputation: 2 361

The TIO link shows a syntax error. – Dennis – 2018-04-14T18:22:18.250

Weird. I think it broke something in TIO since my code doesn't have any braces. The error is SyntaxError: Unexpected token } <--- my code has no } – Muhammad Salman – 2018-04-14T18:25:57.103

Where does this work then? – Dennis – 2018-04-14T18:39:34.480

By itself, this does not work, it needs an ending semi-colon at the least. while(1); is already used by an existing answer if you look into the leaderboard snippet in the challenge. – user41805 – 2018-04-14T19:15:37.047

1@MuhammadSalman The reason the code doesn't work is because you are declaring a loop with no contents which is not valid syntax for JavaScript. The semicolon is required so that the loop contains a single empty statement. – fəˈnɛtɪk – 2018-04-15T01:49:51.597

1Oh yeah , I forgot. – Muhammad Salman – 2018-04-15T04:05:31.010

This is also still longer than the current answer of for(;;); for JavaScript

– fəˈnɛtɪk – 2018-06-25T14:18:40.897

1

Gol><>, 0 bytes

Try it online!

Just for completeness. This works just like zero-byte Befunge infinite loop.

Bubbler

Posted 2015-10-02T17:20:15.947

Reputation: 16 616

1

C (gcc), 16 bytes

main(){for(;;);}

Try it online!

Marhtini

Posted 2015-10-02T17:20:15.947

Reputation: 11

1

DUP, 6 bytes

[1][]#                            {infinite while loop}

This is a proper and implementation independent solution. Mama Fun Roll’s 2 byte solution only works with the quirkster Javascript implementation that behaves a bit strangely in some cases.

M L

Posted 2015-10-02T17:20:15.947

Reputation: 2 865

1

Q'Nial7, 22 bytes

WHILE =1 DO 1 ENDWHILE

M L

Posted 2015-10-02T17:20:15.947

Reputation: 2 865

1

Ahead, 1 byte

l

l turns the head left 45 degrees. Since the board is 1x1, the head will keep trying to move but go nowhere. The head never stops until it encounters a @, so this "loops" forever.

I figured this would be more interesting than the alternative solution, one space character.

snail_

Posted 2015-10-02T17:20:15.947

Reputation: 1 982

1

HadesLang, 15 bytes

while[true]
end

Azeros

Posted 2015-10-02T17:20:15.947

Reputation: 41

1

LOLZ, 9 Characters

lolloolol

lol: creates the loop statement

loolol: returns the value "1"

Cevat Barış Yılmaz

Posted 2015-10-02T17:20:15.947

Reputation: 11

1

Flobnar, 1 byte

@

Try it online!

@ indicates the entry point of a program and evaluates the cell to its west. There is nothing to the west, meaning it wraps around and evaluates @ again.

The language spec is unclear about whether it is legal for @ to evaluate itself recursively. The linked interpreter supports it. It also does tail-call elimination, meaning that this is really an infinite loop and will not cause a stack overflow.

Esolanging Fruit

Posted 2015-10-02T17:20:15.947

Reputation: 13 542

1

Piet, 0 bytes

An empty image will make Piet loop around forever...

FireCubez

Posted 2015-10-02T17:20:15.947

Reputation: 857

1

INTERCAL, 16 bytes

(1)DOCOMEFROM(1)

Try it online!

Probably the first time I've managed to get away with not GIVING UP. This program goes to line 1 after line 1 finishes executing. (The shorter (1)DO(1)NEXT very quickly maxes out the NEXT stack and disappears into the black lagoon.)

Unrelated String

Posted 2015-10-02T17:20:15.947

Reputation: 5 300

1

TIS-100, 0/5 bytes

Nonempty solution:

JRO 0

It's really hard to tell the difference between "halting" and "repeating infinitely" in TIS-100, since every program loops automatically. As such, I have done both an empty and nonempty solution.

Tux1

Posted 2015-10-02T17:20:15.947

Reputation: 41

1

Turing Machine But Way Worse, 27 13 bytes

0 0 0 1 0 0 0

Try it online!

Explanation:

Rest of the number isn't necessary, as they are text-based and pointer commands.

0 0 0 1 0 0 0-> do not halt
  |     | |
  |     | +-> do not print
  |     +--> go to state 0
  |
  +---------> if state 0

u_ndefined

Posted 2015-10-02T17:20:15.947

Reputation: 1 253

Just 0 0 0 1 0 1 0 would work, but that's a duplicate answer of mine – MilkyWay90 – 2019-06-01T13:36:51.590

1

Brian & Chuck, 7 bytes

!{?
!{?

Try it online!

Dorian

Posted 2015-10-02T17:20:15.947

Reputation: 1 521

1

Backshift, 1 byte

0

How it works

This tries to move 0 1-0=1 times backwards. This does not halt, as it tries to do this until it encounters a 1 (which is impossible).

Adar, 7 bytes

[(0,1)]

How it works

This is a looping counter; that means it starts from 0 and counts up in 1s forever.

user85052

Posted 2015-10-02T17:20:15.947

Reputation:

2This should be split up into two answers. – lirtosiast – 2019-07-06T09:44:55.330

1

Forth, 19 bytes

: b begin again ; \ compiles word that loops endlessly
b                 \ executes this word

Try it online!

nonForgivingJesus

Posted 2015-10-02T17:20:15.947

Reputation: 129

1

Malbolge, 1787 bytes

This one doesn't rely on interpreter bug.

bP&A@?>=<;:9876543210/.-,+*)('&%$T"!~}|;]yxwvutslUSRQ.yx+i)J9edFb4`_^]\yxwRQ)(TSRQ]m!G0KJIyxFvDa%_@?"=<5:98765.-2+*/.-,+*)('&%$#"!~}|utyrqvutsrqjonmPkjihgfedc\DDYAA\>>Y;;V886L5322G//D,,G))>&&A##!7~5:{y7xvuu,10/.-,+*)('&%$#"yb}|{zyxwvutmVqSohmOOjihafeHcEa`YAA\[ZYRW:U7SLKP3NMLK-I,GFED&%%@?>=6;|9y70/4u210/o-n+k)"!gg$#"!x}`{zyxZvYtsrqSoRmlkjLhKfedcEaD_^]\>Z=XWVU7S6QPON0LKDI,GFEDCBA#?"=};438y6543s1r/o-&%*k('&%e#d!~}|^z]xwvuWsVqponPlOjihgIeHcba`B^A\[ZY;W:UTSR4PI2MLKJ,,AFE(&B;:?"~<}{zz165v3s+*/pn,mk)jh&ge#db~a_{^\xwvoXsrqpRnmfkjMKg`_GG\aDB^A?[><X;9U86R53ONM0KJC,+FEDC&A@?!!6||3876w4-tr*/.-&+*)('&%$e"!~}|utyxwvutWlkponmlOjchg`edGba`_XW\?ZYRQVOT7RQPINML/JIHAFEDC&A@?>!<;{98yw5.-ss*/pn,+lj(!~ff{"ca}`^z][wZXtWUqTRnQOkNLhgfIdcFaZ_^A\[Z<XW:U8SRQPOHML/JIHG*ED=%%:?>=~;:{876w43210/(-,+*)('h%$d"ca}|_z\rqYYnsVTpoRPledLLafIGcbE`BXW??TY<:V97S64P31M0.J-+G*(DCB%@?"=<;|98765.3210p.-n+$)i'h%${"!~}|{zyxwvuXVlkpSQmlOjLbafIGcbE`BXW??TY<:V97S64P31M0.J-+G*(D'%A@?"=<}:98y6543,1r/.o,+*)j'&%eez!~a|^tsx[YutWUqjinQOkjMhJ`_dGEaDB^A?[><X;9U86R53O20LKJ-HG*ED'BA@?>7~;:{y7x5.3210q.-n+*)jh&%$#"c~}`{z]rwvutWrkpohmPkjihafI^cba`_^A\[>YXW:UTS5QP3NM0KJ-HGF?D'BA:?>=~;:z8765v32s0/.-nl$#(ig%fd"ca}|_]yrqvYWsVTpSQmPNjMKgJHdGEa`_B]\?ZY<WVUTMR5PO20LK.IHA))>CB%#?87}}49zx6wu3tr0qo-nl*ki'hf$ec!~}`{^yxwvotsrUponQlkMihKIe^]EEZ_B@\?=Y<:V97S64P31M0.J-+GFE(C&A@?8=<;:{876w43s10qo-&%kk"'hf$ec!b`|_]y\ZvYWsVTpSQmlkNiLgf_dcba`C^]\?ZY;WV97SLK33HM0.J-+G*(D'%A$">!};|z8yw543t1r/(-,+*)(i&%fd"!~}|_t]xwvutslqTonmPkjLhKIeHFbEC_^A?[TSX;9UT7R4JIN1/K.,H+)E(&B%#?"~<}{987x/4ussr).o,+l)(h&ge#db~a_{^\x[YutWrTjinQOkNLhgJeG]\aDB^]@[=SRW:877LQP3N0FEJ-+**?DC&A#98=~|:98yx/4u21rp(',mk)(ig%|{"ca}`^z][wZXtWUqTRnQOkNLhKIedcFE`YB@@?ZYRW:UTS6QPO11F..CHGF)(CB;@#>!~;XzV7gwu-QrrqMoJIkZF'WC$#AbQ`_{^L9wI64"VDConzl+j);JJ%qGFEZ~}]{ygwRuc8aSq44"H1Y.iV,e*RQ

Try it online!

Krzysztof Szewczyk

Posted 2015-10-02T17:20:15.947

Reputation: 3 819

1

jq -n, 9 + 3 = 12 bytes

def f:f;f

The -n option makes jq not consume any input, otherwise it waits for stdin before starting the loop.

nyuszika7h

Posted 2015-10-02T17:20:15.947

Reputation: 1 624

1

1+, 5 bytes

1##1#

Explanation:

1#    [Jump to 1st hash]
  #   [1st hash in program (counting starts from 0)]
   1# [Jump to 1st hash]

Alternatively, 5 bytes

(|())

Explanation:

This program define and execute a function with an empty name. The function calls itself. Thus, it is infinite recursive.

user85052

Posted 2015-10-02T17:20:15.947

Reputation:

Whew... Aww, counting starts from 0! I thought it starts from 1. – HighlyRadioactive – 2019-09-25T04:52:39.830

1

Pizza Delivery, 2 bytes

(]

While L is zero, end while.

user85052

Posted 2015-10-02T17:20:15.947

Reputation:

1

Nandy, 4 bytes

:#()

Never decrement: never end. (0 NAND 0 is 1. Thanks to @EdgyNerd for noting that.)

user85052

Posted 2015-10-02T17:20:15.947

Reputation:

This can be 4 bytes by just flipping to top of the stack then looping (since 0 NAND 0 is 1) – EdgyNerd – 2019-10-06T14:32:06.543

1

Cascade, 1 byte

|

Try it online!

or (if my understanding is correct) any other one-byte program from @/\!^?_$<>=~+-*:%().#--that is, any instruction which depends on the return value of what's below it, either directly or to the left or right, since in the case of a one-byter all three of those wrap back around to the same command. I suspect that most if not all of these would run out of call stack given enough time, but I don't know Perl so I can't quite tell what the interpreter is actually doing.

Unrelated String

Posted 2015-10-02T17:20:15.947

Reputation: 5 300

1Perl 6 doesn't have a hard recursive limit, so it would just recurse until it runs out of memory – Jo King – 2019-09-25T06:47:45.353

1

Plumber, 7 bytes

[]
[[]]

This is the shortest possible infinite loop in Plumber.

Plumber programs are divided into units, which are always two characters wide (and padded to two with spaces if shorter). This one consists of three units: [], [[, and ]]. When a Plumber program is run, a 0 packet is dropped from all [] on the top row. This packet can be picked up by a ][, which pushes it to the sides.

A [[ will push it to the right, but it continues down (and is destroyed upon leaving the 2d space). Likewise, when the ]] is pushed into from either side (left in thus case), the packet is dropped and destroyed, and pushed back to the left. The [[ pushes it back to the ]], and this continues indefinitely.

Redwolf Programs

Posted 2015-10-02T17:20:15.947

Reputation: 2 561

1

W i, 1 byte

I

Forever, execute the input (which is then not printed to the console).

W i, 4 bytes

Pretty much a terrible language for looping.

i""E

Explanation

i   E % Foreach the range from 0 to positive infinity:
 ""   % Push the null string

Flags:i  % Implicit print disabled
```

user85052

Posted 2015-10-02T17:20:15.947

Reputation:

Foreaching to infinity? That sounds like an interesting approach. Reminds me of TRANSCRIPT, which has no while loop -> no infinite loop -> not interesting to me. If only variables can be infinity... – HighlyRadioactive – 2019-12-21T13:56:22.683

1I feel glad that you find my language interesting! (I initially didn't think it as interesting...) – None – 2019-12-21T13:57:30.243

(Very off topic and self-promoting and attention-drawing and... but: Do you have prime detection in 1+?) – HighlyRadioactive – 2019-12-21T14:00:54.903

And also, if W have "implicit print disable command" just like Retina, it could be 3 bytes XD – HighlyRadioactive – 2019-12-21T14:02:12.817

1Nope. The Foreach loop body has to be exist in W. If not this foreaches over the implicit input printing positive infinity on each iteration. – None – 2019-12-21T14:03:29.543

I mean I wish there is a command which makes the implicit printing "silent". For example, if it is ., then the program i.E would be 3 bytes. – HighlyRadioactive – 2019-12-21T14:04:56.867

(I have already made . an inclusive range but oh well.) Adding a flag might be nice, but I am too lazy to do this... Also I am trying to make W extremely simple as well as making it concise, so I will not create the . instruction just for this specific operation. (By the way an explicit p already disables the implicit input.) – None – 2019-12-21T14:07:26.053

Let us continue this discussion in chat.

– HighlyRadioactive – 2019-12-21T14:08:22.013

1

Taktentus, 4 bytes

_:=0

This is jump for line number 0 (first)

In English: https://esolangs.org/wiki/Taktentus

0x3

Posted 2015-10-02T17:20:15.947

Reputation: 21

1

Ada, 49 47 bytes

procedure L is begin loop null;end loop;end L;

I'm guessing there aren't many Ada entries on Code Golf!

Naturally it should look like

procedure L is 
begin 
   loop 
      null; 
   end loop; 
end L;

and do exactly what it says on the tin.

Brian Drummond

Posted 2015-10-02T17:20:15.947

Reputation: 111

1Can you remove the spaces after the semicolons? – kirbyfan64sos – 2015-10-02T20:30:01.063

Yes ... 47 bytes. Thanks! (even though it's making me grind my teeth to look at :-) – Brian Drummond – 2015-10-02T21:01:43.257

1

CoffeeScript, 6 bytes

loop 0

Interesting fact thanks to Martin Büttner, not sure if there's any practical use to it though.

Previous attempt (8 bytes):

1while!0

There is only a while loop, no for (though there are for..in and for..of).

rink.attendant.6

Posted 2015-10-02T17:20:15.947

Reputation: 2 776

CoffeeScript actually has a keyword for infinite loops: loop 1 – Martin Ender – 2015-10-02T19:19:43.790

1

Swift, 12 bytes

while(1>0){}

Najkin

Posted 2015-10-02T17:20:15.947

Reputation: 171

1What about while(1){}? – None – 2017-01-30T17:58:15.857

The condition needs to be a Bool, so while(1) wouldn't compile. You probably can save 1 byte by removing the parens around the condition: while 1>0{} – Tiziano Coroneo – 2019-08-07T10:56:59.193

1

Snowman 1.0.2, 6 chars

~:1;bD

~ sets all the variables to active, :...;bD is a "do" loop (i.e. continues looping while the block returns a truthy value), and 1 is 1.

Doorknob

Posted 2015-10-02T17:20:15.947

Reputation: 68 138

1

Rust, 17 chars

fn main(){loop{}}

Nothing much interesting to see here.

Doorknob

Posted 2015-10-02T17:20:15.947

Reputation: 68 138

1

FlogScript, 6 bytes

This creates a string containing code for duplicating the top value on the stack, then popping it and executing it as code. Then it is duplicated, popped, and executed as code.

{.~}.~

mbomb007

Posted 2015-10-02T17:20:15.947

Reputation: 21 944

1

HALT, 7 bytes

1 SET 1

This set's the pointer to 1, this is run forever because there is no HALT; command. This will bybass fail-safes to prevent infinite looping.

Try This

Downgoat

Posted 2015-10-02T17:20:15.947

Reputation: 27 116

1

Lua, 11 bytes

In Lua, you can set labels that can be used with the goto statement!

::y::goto y

Digital Veer

Posted 2015-10-02T17:20:15.947

Reputation: 241

1

Basilisk, 5 bytes

:A1gA

Pretty simple.

Explanation

  • :A

Defines position A.

  • 1gA

Pushes one and goes to position A in code. Since the gA pops the top value in stack, if the loop were ever to end, it would not print anything.

The_Basset_Hound

Posted 2015-10-02T17:20:15.947

Reputation: 1 566

1

STATA, 10 bytes

while 1{
}

Apparently for loops in STATA always halt, but while loops can be infinite.

bmarks

Posted 2015-10-02T17:20:15.947

Reputation: 2 114

Is the line break needed? I've never used STATA – Albert Renshaw – 2016-05-12T20:14:21.037

1

@AlbertRenshaw The line break is required, and it will throw a syntax error if it is not there. See http://www.stata.com/manuals13/pwhile.pdf#pwhile for details.

– bmarks – 2016-05-17T14:19:31.103

What about a: goto a? :D 9 bytes —— http://www.stata.com/manuals14/m-2goto.pdf

– Albert Renshaw – 2016-05-17T17:42:37.847

In-fact, the space after a: might not be needed, I don't have STATA so I can't test but I'd imagine it's possible to omit the space and get it down to 8 bytes – Albert Renshaw – 2016-05-17T17:44:04.377

1

Objective-C, 1716

-(id)a{for(;;);}

Albert Renshaw

Posted 2015-10-02T17:20:15.947

Reputation: 2 955

1

Java6 : 50 Bytes

In Java 6 and previous versions you can execute static initialization block without having main in your class file.

class A{static{for(int i=1;i>0;);System.exit(0);}}

CoderCroc

Posted 2015-10-02T17:20:15.947

Reputation: 337

1Wouldn't for(;;); work just as well as for(int i=1;i>0;);, or is there some restriction in Java 6? – ETHproductions – 2015-10-04T00:00:23.070

1while(true) is shorter than and as valid as for(int i=1;i>0;). – user8397947 – 2016-05-29T15:47:15.387

1

VBScript, 17 bytes

do
loop while 1

Kevin Elevin

Posted 2015-10-02T17:20:15.947

Reputation: 21

1

Batch, 3 bytes

@%0

user2428118

Posted 2015-10-02T17:20:15.947

Reputation: 2 000

This produces output. Why not use @%0? – Neil – 2015-10-03T20:54:55.567

@Neil Thanks, I used your suggestion. – user2428118 – 2015-10-05T10:48:13.063

You forgot to update the number of bytes. (The editing restrictions suck, otherwise I would have suggested the edit.) – Neil – 2015-10-05T10:59:05.307

1

Pascal, 32 bytes

program l;begin while 1=1do;end.

A full program in just one line.

  • program l;: Start a new Pascal program
  • begin: Begin a code section
  • while 1=1do;: Do nothing (; / NOP) as long as 1=1, which shorter than true. Identifiers (do for instance) are not allowed to begin with a digit, so we can omit the space here and save one byte.
  • end.: End the code section

GiantTree

Posted 2015-10-02T17:20:15.947

Reputation: 885

1

C++, 15 bytes

Same as C:

main(){main();}

Lynn

Posted 2015-10-02T17:20:15.947

Reputation: 55 648

4http://stackoverflow.com/a/2532922 says "The C++ Standard says that you may not call main() from your own code." – Neil – 2015-10-03T20:50:25.603

2PPCG says "if your code works on some environment, it's fine", and it works for me. A standards-complying solution would be int main(){for(;;);}, I think. – Lynn – 2015-10-04T19:21:43.100

1

F#, 14 bytes

while 0<1 do()

Self-explanatory.

Lynn

Posted 2015-10-02T17:20:15.947

Reputation: 55 648

Also works in Standard ML – Demi – 2015-10-11T00:05:10.393

Nice one. I thought doing it via recursion would be shorter, but this beats it by a byte. =) – Roujo – 2016-02-15T22:26:03.410

1

AHK, 4 bytes

loop

quick and simple

downrep_nation

Posted 2015-10-02T17:20:15.947

Reputation: 1 152

1I'm going to disagree with this answer here as this won't execute persistently without a #persistent directive present or a Hotkey (which forces a #Persistent) defined in your script. . AHK is a bracket based language, your loop has no defined brackets and will simply exit after the first iteration, in fact your code won't even perform a single loop. This answer is just wrong. – errorseven – 2015-11-28T20:21:23.397

1@ahkcoder wrong,add a msgbox under it to see it does run forever – downrep_nation – 2015-11-28T20:37:20.243

1Exactly, you have to add code in order for it execute correctly. Your program is an incomplete implementation, therefore wrong. – errorseven – 2015-11-28T20:45:00.200

1

Pip, 3 bytes

W1x

Basically a while 1: 0 answer.


A more interesting 2-byte solution that doesn't quite fit the rules:

Vf

f is the current function; V evaluates it. This theoretically goes on forever, but in actuality it ends up causing infinite recursion in the interpreter, which very quickly exits with

Fatal error: maximum recursion depth exceeded while calling a Python object

Oh well.

DLosc

Posted 2015-10-02T17:20:15.947

Reputation: 21 213

1

Fourier, 3 bytes

1()

Repeats until the result of the loop equals 1, which it never does.

Beta Decay

Posted 2015-10-02T17:20:15.947

Reputation: 21 478

1

Aheui, 0 bytes

Aheui is a Befunge-like, and the empty program is an infinite loop for exactly the same reason.

Lynn

Posted 2015-10-02T17:20:15.947

Reputation: 55 648

1

C, 16 bytes

main(){for(;;);}

A simple C loop construct. A for loop does not require curly brackets. 

awd123

Posted 2015-10-02T17:20:15.947

Reputation: 21

Is there a particular dialect of C that lets you omit the parenthesis after main? GCC throws an error if I try to compile this. – Mark – 2015-10-05T07:25:43.810

@Mark Whoops, I missed that. Editing – awd123 – 2015-10-05T12:04:41.547

1

CFL 2 (ComeFrom 2), 17 bytes

10 comefrom 20
20 

Try it here.

user2428118

Posted 2015-10-02T17:20:15.947

Reputation: 2 000

1

Carriage, 30 bytes

111-@11-~!$11111++++11-~@11-~!

user2428118

Posted 2015-10-02T17:20:15.947

Reputation: 2 000

1

SmallTalk – 18 bytes

[true]whileTrue:[]

user15259

Posted 2015-10-02T17:20:15.947

Reputation:

1

Ceylon, 30 29 bytes

This is an eternal loop (which also will not run out of memory or stack or something), 30 bytes:

shared void l(){while(true){}}

This can be golfed down one more byte to 29:

shared void l(){while(1<2){}}

In the Ceylon web runner you have to remove the function wrapper, getting this 12 byte snipped:

while(1<2){}

(I had to kill my Chromium window when trying this.)

This eternal recursion will quickly run out of stack space (about 1024 calls on my JVM implementation, with a StackOverflowError), 22 bytes:

shared void r() {r();}

I wouldn't consider this a valid solution.

Note that the for-loop (which is the shortest endless loop in Java) in Ceylon can only loop over an iterable, and all ways of constructing an infinite iterable are longer. Here is one example (38 bytes):

shared void f(){for(x in{1}.cycled){}}

Paŭlo Ebermann

Posted 2015-10-02T17:20:15.947

Reputation: 1 010

1

Poslin, 20 bytes

[ .true ! | ]while !

This does the part between | and ] as long as the part between [ and | returns the true value.

.true ! creates the true value at compile time.

[ .true & | ]while !

works just the same, but here the operation .true is called on every iteration.

Thomas Bartscher

Posted 2015-10-02T17:20:15.947

Reputation: 83

1

Prelude, 3 bytes

1()

Any other non-zero digit could replace the 1. This is essentially the same as the Brainfuck solution (just adding it for completeness).

Martin Ender

Posted 2015-10-02T17:20:15.947

Reputation: 184 808

1

PHP, 10 8 bytes

The for(;;) solution has been posted enough, Time for this one:

while(1)

while(1){}

Martijn

Posted 2015-10-02T17:20:15.947

Reputation: 713

2You're missing a trailing ;. This will produce a parse error. – insertusernamehere – 2015-11-15T09:51:08.067

1

D , 21 bytes

void main(){for(;;);}

No language used with D in it name.

Kishan Kumar

Posted 2015-10-02T17:20:15.947

Reputation: 427

1

GOTO++, 19 bytes

§1 GOTOPASMALIN %1

§1 is the label 1

GOTOPASMALIN is a deterministic goto instruction that goes to the label X specified with the argument %X.

goto pas malin literally means Not-clever goto in French. It is named this way because there are keywords in GOTO++ to do goto at random, on a random label in a list, etc.

Fatalize

Posted 2015-10-02T17:20:15.947

Reputation: 32 976

1

Octave, 10 bytes

1 byte shorter than @flawr's answer ...

do until 0

(Haven't tested it in Matlab though...)

dcsohl

Posted 2015-10-02T17:20:15.947

Reputation: 641

1

HP48's RPL, 18 bytes

« DO UNTIL 0 END »

You may remove the spaces around the « and » but the calculator will add them again for you.

That's the source size; "binary" size when stored in the calculator is actually longer (25.5 bytes).

LeFauve

Posted 2015-10-02T17:20:15.947

Reputation: 402

1

Sclipting, 6 bytes

Encoded in UTF-16.

到終

This is a while-false loop with an empty body. This assumes that the program input is falsy, but I interpret the problem statement as saying that the input will be empty, so this is fine.

Timwi

Posted 2015-10-02T17:20:15.947

Reputation: 12 158

1

Emily, 12 bytes

while^(1)^()

I was a character short of 30 for the body of this post. :/

kirbyfan64sos

Posted 2015-10-02T17:20:15.947

Reputation: 8 730

1

Delphi, 35 bytes

program P;begin while true do;end.

Managed to beat C# this time :)

James

Posted 2015-10-02T17:20:15.947

Reputation: 31

Whoops just saw the pascal solution - more elegant :( – James – 2015-10-09T11:52:52.727

1

Coffee Script, 9 8 bytes

1while 1

Grant Davis

Posted 2015-10-02T17:20:15.947

Reputation: 693

1

Gema, 18 15 characters

\A=@a{a};a:\P?=

Sample run:

bash-4.3$ gema '\A=@a{a};a:\P?='

manatwork

Posted 2015-10-02T17:20:15.947

Reputation: 17 865

1

ShadyAsFuck, 2 bytes

a]

This starts a for loop that never increases or decreases. This can also be represented by

+(

As this is a substitution language for Brainfuck (and there is a more popular answer in that language for this already), please do not consider this for the winning code.

Addison Crump

Posted 2015-10-02T17:20:15.947

Reputation: 10 763

Why the down vote? – Addison Crump – 2015-10-12T19:34:20.527

1The downvote isn't mine, but I suppose it's because of this: If your language of choice is a trivial variant of another (potentially more popular) language which already has an answer (think BASIC or SQL dialects, Unix shells or trivial Brainfuck-derivatives like Alphuck), consider adding a note to the existing answer that the same or a very similar solution is also the shortest in the other language. – Dennis – 2015-10-12T19:41:41.493

1No need for the giant header note. This challenge specifically says newer languages are allowed. – Geobits – 2015-10-12T20:07:11.633

Oh, whoops... Missed that. Thanks. – Addison Crump – 2015-10-12T20:16:51.103

1

AppleScript, 10 Bytes

In Script Editor... it's 10 bytes, which is way better than I expected nonetheless.

repeat
end

Thanks to @Mark for pointing out that the 0 byte "loop" was no loop at all.

Addison Crump

Posted 2015-10-02T17:20:15.947

Reputation: 10 763

osascript -e "" doesn't loop forever. A quick check with Instruments shows that it's simply performing a blocking read on standard input. – Mark – 2015-10-19T20:02:00.880

Hmm. I'll update, seems that way. Thanks. – Addison Crump – 2015-10-19T20:24:41.083

1

MIPS, 6 bytes

I didn't use mips for ages, but if i remember correctly, it will be something like that : a: j a;

user902383

Posted 2015-10-02T17:20:15.947

Reputation: 1 360

Actually 4 bytes – qwr – 2015-12-24T03:34:39.843

1

Cardinal, 2 bytes

%$

or

$%

In Cardinal each pointer carries exactly 2 unsigned 8 bit values, one active, one inactive. Both are initialized to 0

% creates 4 pointers moving in the cardinal directions.

$ moves the pointer to x,y = active,inactive value of the pointer

M L

Posted 2015-10-02T17:20:15.947

Reputation: 2 865

1

Staq, 2 bytes

()

( jump to corresponding ) if the top stack value is greater than 0

) jump back to corresponding ( if the top stack value is 0 (or if it does not exist)

M L

Posted 2015-10-02T17:20:15.947

Reputation: 2 865

1

PARI/GP, 9 bytes

while(1,)

Or equivalently:

until(0,)

alephalpha

Posted 2015-10-02T17:20:15.947

Reputation: 23 988

1

Python 3, 100 79 bytes

x=lambda x:x(x)
while x:
    try:x(x)
    except BaseException:pass

Note: this doesn't freeze my IDLE or my machine, nor does it hog lots of memory: it just occupies (more than) a core on an eight-core processor.
Also note: pressing CTRL-C (or whatever you have KbInt bound to) a few times will eventually cause it to error and quit. I could write in protection for that but it's pointless in this case.

cat

Posted 2015-10-02T17:20:15.947

Reputation: 4 989

You can't use BaseException to catch all exceptions? – ASCII-only – 2016-03-24T14:18:10.567

@somebody I tend to forget BaseException catches KeyboardInterrupt. – cat – 2016-03-24T14:32:46.920

@somebody I couldn't quite tell you why I answered this way in the first place... – cat – 2016-03-24T14:34:04.437

1

GOLF, 10 bytes

didn't see a golf response

lx:
jmp lx

lx: sets a goto marker, jmp sends you to the marker. Note that the marker name cannot be a single character (as far as I know) because the alphabet characters are reserved for registers.

Liam

Posted 2015-10-02T17:20:15.947

Reputation: 3 035

1

Perl 6, 7 5 bytes

The standard boring one is just an empty loop (;;){} construct.
( spelled for(;;){} in other languages )

loop {} # 7 bytes

There are also exotic ones as well

  • infinite sequence of the Any type object ( default value in $_ )

    .roll(*) # 8 bytes
    
  • unterminated sequence generator (0,1,2,3,4 ... Inf, Inf, Inf, Inf)

    0...* # 5 bytes
    

Brad Gilbert b2gills

Posted 2015-10-02T17:20:15.947

Reputation: 12 713

1

Hassium, 17 Bytes

Calls the main() infinitely.

func main()main()

Run online and see here

Jacob Misirian

Posted 2015-10-02T17:20:15.947

Reputation: 737

1

JacobFck

:A_A

Expanded and commented here

Jacob Misirian

Posted 2015-10-02T17:20:15.947

Reputation: 737

1

, 2 chars / 4 bytes

↻;

I won't add a Try it here because you probably don't want to try it.

Mama Fun Roll

Posted 2015-10-02T17:20:15.947

Reputation: 7 234

1

ಠ_ಠ, 31 bytes

ಠ4ಠ
ಠ4ಠ
ಠ1ಠ
ಠ?ಠ

Explanation

ಠ4ಠ # Push 4 to the stack [4]
ಠ4ಠ # Push 4 to the stack [4,4]
ಠ1ಠ # Push 1 to the stack [4,4,1]
ಠ?ಠ # Essentially: go to line 4

Mama Fun Roll

Posted 2015-10-02T17:20:15.947

Reputation: 7 234

This needs a special encoding. – Addison Crump – 2015-11-18T10:33:51.417

What does that mean? – Mama Fun Roll – 2015-11-18T14:37:14.467

As in, a special encoding should be made for this so that it's not too long in bytes. – Addison Crump – 2015-11-18T14:37:54.997

Ah, I see. Any suggestions? – Mama Fun Roll – 2015-11-18T14:42:39.847

Are there any characters that ಠ_ಠ would never use? – Addison Crump – 2015-11-18T14:43:37.047

Basically everything is within ASCII range except for 益 and ಠ. – Mama Fun Roll – 2015-11-19T01:50:18.173

I think you can do 9 bytes like this: 4\n4\n1\n? – Erik the Outgolfer – 2017-09-30T18:26:56.407

1

Pyth, as of 11/3/15: 1 byte

#

There is no trailing space in this version. The requirement that statements have a value has been removed.

isaacg

Posted 2015-10-02T17:20:15.947

Reputation: 39 268

1

Haystack, 2 bytes

v|

Haystack is a 2D-based grid language which starts executing in the upper left-hand corner. The characters <>v^ tells the "pointer" in which direction to go. It continues in the same direction until it hits another direction identifier or the needle |.

sweerpotato

Posted 2015-10-02T17:20:15.947

Reputation: 2 457

1

DStack, 3 bytes

skt

Language created by my few days ago

DarkPhantom

Posted 2015-10-02T17:20:15.947

Reputation: 191

Is there an online interpreter for this language? – user41805 – 2015-11-11T05:34:47.233

No, the only interpreter that exists is this, the language I created it a few days ago.

– DarkPhantom – 2015-11-11T05:40:05.480

1

Minecraft snap. Ver. 15w46a, 2 + 0 = 2 bytes

Note that this version of this "language" was created after the question was asked.

This is using this version of byte counting.

the system

Put inside of an always active repeating command block, it will, indeed, loop forever with no output.

Addison Crump

Posted 2015-10-02T17:20:15.947

Reputation: 10 763

might want to note that this is 1.9 only – anOKsquirrel – 2015-11-12T23:34:00.227

1

ShapeScript, 8 bytes

'0?!'0?!

This requires the latest version of ShapeScript, since I have just implemented tail call optimization.

The online interpreter will exit quietly after one minute. Try it online!

How it works

'       Push a string that, when evaluated, does the following:
  0?      Push a copy of the topmost item on the stack (i.e., this string).
  !       Evaluate the copy.
'
0?      Push a copy of the topmost item on the stack.
!       Evaluate the copy.

Dennis

Posted 2015-10-02T17:20:15.947

Reputation: 196 637

1

Thue, 11 bytes

0::=0
::=
0

(Silly 30 character minimum)

SuperJedi224

Posted 2015-10-02T17:20:15.947

Reputation: 11 342

1

BASIC, 8 bytes

2 GOTO 1

A simple answer, but hey, it uses basic!

Also, for fun:

Brainf*ck, 3 bytes

+[]

takra

Posted 2015-10-02T17:20:15.947

Reputation: 793

1

Go, 32 bytes

surprisingly long. surprisingly, never ends.

package main;func main(){for{}}

Fun fact: compiling this, due to the go tail-call and 03- optimising compiler, this generates an executable with absent .TEXT and .DATA sections.

cat

Posted 2015-10-02T17:20:15.947

Reputation: 4 989

1

Arcyóu, 6 bytes

(@ 1 1

While 1: append 1. Note that this will blow the stack eventually, since it's slowly building a list of 1s in memory.

jqblz

Posted 2015-10-02T17:20:15.947

Reputation: 2 062

1

Emacs Lisp, 9 bytes

(while t)

Pretty straight-forward.

Lord Yuuma

Posted 2015-10-02T17:20:15.947

Reputation: 587

1

Samau, 3 bytes

`xx

Explanation

`x      push the quoted function [x]
  x     execute it without popping it 

It works like the Mathematica program #0[]&[], but Samau doesn't have an iteration limit.

alephalpha

Posted 2015-10-02T17:20:15.947

Reputation: 23 988

1

ResPlicate, 5 bytes

1 4 2

After 1 step, this expands to 2 2 2 2, which is the smallest period 1 oscillator. That this is true was once the subject of a lengthy proof, which was thenceforth unceremoniously deleted when I pointed out that the fact was kind of a little bit obvious. I'm sure you can re-derive said proof yourself.

quintopia

Posted 2015-10-02T17:20:15.947

Reputation: 3 899

So it's a form of cellular automaton? – SuperJedi224 – 2016-01-02T01:13:22.487

@SuperJedi224 It's closer to being a Post canonical system. It's nearest neighbor in automaton space is probably Self-BCT, though it is not clear if the latter is usable or even Turing-complete. ResPlicate is at least an automaton with only a single state. – quintopia – 2016-01-02T01:55:14.943

1

STXTRM, 2 bytes

;;

Program execution in this language is... strange.

LegionMammal978

Posted 2015-10-02T17:20:15.947

Reputation: 15 731

1

Dirst, 4 bytes

lpn_0

Loops as long as 0 is equal to 0.

LegionMammal978

Posted 2015-10-02T17:20:15.947

Reputation: 15 731

1

GOTO, 9 bytes

M1:GOTOM1

Simply defines a label that goes to itself. GOTO seems to be Turing complete (by translation from a Minsky machine), so it should count as a programming language.

LegionMammal978

Posted 2015-10-02T17:20:15.947

Reputation: 15 731

1

Sally, 20 bytes

void a a
void main a

Why the extra four bytes? First, I pipe it to sally2c, which transpiles it to C:

#include "sally.h"

/* {void -> void}: */ void apply_a(void)
{
  apply_a();
}

/* {void -> void}: */ int main(int argc, char ** argv)
{
  if(argc <= 0) { fprintf(stderr, "0 values needed"); exit(1); }
  apply_a();
  {
  }
  argv = argv;
  return 0;
}

Then, during compilation, I use the -O2 flag for tail-recursion (otherwise it segfaults), which I believe is necessary for consideration as a language.

LegionMammal978

Posted 2015-10-02T17:20:15.947

Reputation: 15 731

1

RPG fixed, 133 bytes

H dftactgrp(*no) actgrp(*new)
H option(*srcstmt:*nodebugio)
H bnddir('QC2LE')
C     A             TAG
C                   GOTO      A

Basically it defines a few headers for it to compile (h-spec) and have to rows of c-specs. If it was written in free format it would have looked like this:

H dftactgrp(*no) actgrp(*new)
H option(*srcstmt:*nodebugio)
H bnddir('QC2LE')
/free
tag a;
goto a;
/end-free

Or in Perl like this:

a:;     # This is a label
goto a; # Goto that label

andlrc

Posted 2015-10-02T17:20:15.947

Reputation: 1 613

For those uncommon languages you should always add a link to an interpreter and/or show an example run of it. Otherwise no one can really judge your answer. Also an explanation of your program would improve your answer a lot. – Denker – 2016-02-16T15:35:28.337

@DenkerAffe Link to an interpreter would be hard if not impossible, as rpg is compiled on an IBM mainframe. A link to a wiki could do though. – andlrc – 2016-02-16T16:09:39.203

Thats fine. Looks a lot better now! – Denker – 2016-02-16T16:47:16.170

1

Condit, 2 bytes

a 

Note the trailing space. Due to what I believe is a bug, the Python 3 interpreter loops infinitely on unrecognized tokens.

LegionMammal978

Posted 2015-10-02T17:20:15.947

Reputation: 15 731

Unless we're using different interpreters, this won't work without a trailing linefeed. – Dennis – 2016-02-16T18:05:56.490

All Unix/GNU utilities will, as their definition of line includes the linefeed. – Dennis – 2016-02-16T21:45:03.023

1

BSM, 1 byte

 

A single space character. Had to use some brute-forcing for this... After about 125 cycles, it loops between the states 55, EF, B1, 5A, AD, B2, D9, DC, 9C, 13, 19, and F9.

LegionMammal978

Posted 2015-10-02T17:20:15.947

Reputation: 15 731

1

Puzzlang, 4 bytes

XX X

I have verified that this is, in fact, the shortest possible solution. Equivalent to +[] in BF.

LegionMammal978

Posted 2015-10-02T17:20:15.947

Reputation: 15 731

1

Carriage, 7 bytes

#11-\@!

Smallest self-copying program that I could find.

LegionMammal978

Posted 2015-10-02T17:20:15.947

Reputation: 15 731

1

DUP, 2 bytes

~!

Try it here.

Found this completely by accident.

Explanation

If the stack is empty, ~ (normally bitwise NOT) just pushes -1 to the stack. !, which is normally lambda execute, pushes 1! to the return stack, which then tells the IP to go back to ~, and the loop goes on.

Mama Fun Roll

Posted 2015-10-02T17:20:15.947

Reputation: 7 234

The quirkster implementation shows a few non-standard behaviors that appear to be implementation errors or maybe specific to Javascript behavior. Cool find, though. Your solution should fill up the return stack rather quickly, so it’s going to crash sooner or later. – M L – 2018-06-03T01:48:37.643

1

Pancake Stack, 71 bytes

Put this # pancake on top!
[a]
If the pancake is tasty, go over to "a".

Yay, self-GOTOs with #pancakes...

LegionMammal978

Posted 2015-10-02T17:20:15.947

Reputation: 15 731

1

Hoon, 4 bytes

|-
$

The |- rune is a synthetic rune that expands to =<($ |.($)), a macro that expands to a self-calling function. That function returns $, the name of a limb. Gates like |. are essentially "objects" in Hoon, called cores, with a list of limbs. $ is the empty name of the limb containing the code to run to call the gate. The code creates a core with one limb, $, that returns the value at the limb $ (itself) and calls it immediately.

RenderSettings

Posted 2015-10-02T17:20:15.947

Reputation: 620

You forgot to make the Hoon, ... a header. – user48538 – 2016-03-08T21:09:58.533

1

Grond, 7 bytes

w(1){}

Compiler here https://github.com/epicTCK/Grond

Bald Bantha

Posted 2015-10-02T17:20:15.947

Reputation: 463

This is a very short answer... Well done! – wizzwizz4 – 2016-03-08T16:50:52.733

1

Gogh, 1 byte

Another Gogh answer!

Ø

The character Ø infinitely loops all code before it. (from the wiki)

Zach Gates

Posted 2015-10-02T17:20:15.947

Reputation: 6 152

1

Factor, 15 bytes

Yea, Factor is verbose.

[ t ] [ ] while

Do nothing forever. Hangs the Listener.

cat

Posted 2015-10-02T17:20:15.947

Reputation: 4 989

Here on PPCG we have such an interesting definition of verbose. – Cyoce – 2016-03-25T06:48:22.293

1

Subleq bytecode, 3 binary words

00 00 00

Equivalent to

*00 = *00 - *00
if(*00 <= 0) goto 00

username.ak

Posted 2015-10-02T17:20:15.947

Reputation: 411

1

Pylongolf2, 2 bytes

><

That's it.

user47018

Posted 2015-10-02T17:20:15.947

Reputation:

1

The Infamous Shakespeare Programming Language, 122 bytes

.
Page,a cat.
Ford,.
Act I:
Scene I:z
[Enter Page and Ford]
Page:
Am I better than zero?
Ford:
If so, let us proceed to z.

clamchowder314

Posted 2015-10-02T17:20:15.947

Reputation: 673

Aren't the descriptions of the characters in the Dramatis Personae just comments? I'm pretty sure this would just terminate on the first iteration. – SuperJedi224 – 2017-01-25T02:03:16.910

If they evaluate to a valid expression, then they will be evaluated. – clamchowder314 – 2017-01-25T22:54:58.753

1

Jumper, 2 bytes

:0

Move along, nothing to see here but a simple self-GOTO...

LegionMammal978

Posted 2015-10-02T17:20:15.947

Reputation: 15 731

1

Sh, 17 bytes

while :;do :;done

Probably the shortest one.
Ungolfed:

while [ : ]; do
:
done

: is a command that always returns 0 (a.k.a. the same as true).


Sh+coreutils, 13 bytes

yes>/dev/null

yes is a program from the coreutils package, that, when not given an argument, continuously outputs y (note the newline), while given an argument, outputs that argument plus a newline continuously. --help and --version display usage and version number, respectively.

Erik the Outgolfer

Posted 2015-10-02T17:20:15.947

Reputation: 38 134

Why did you post this as a new answer instead of an edit to this one? Also, your "ungolfed" code doesn't do the same as the golfed code. [ : ] returns 0 because the string : is non-empty, not because it executes :.

– Dennis – 2016-05-15T17:58:26.863

@Dennis I thought that code between [ ] is actually executed. – Erik the Outgolfer – 2016-05-15T18:32:52.827

No, that's not what happens. [ is an alias for test. If expression is a single argument, test returns false if the argument is null and true otherwise.

– Dennis – 2016-05-15T20:59:23.300

1

Parallax Assembly, 0 bytes

The effect if set up correctly leaves the processor core initialized to zeros, which happens to be a nop. Running off the end executes the processor special registers, which also happen to be initialzed to zero except for ina, but the high bits are zero (for some reason this particular CPU floats low rather than high) so it's still a nop, and loops back to the beginning by overflowing the IP register.

Incidentally a blank CPU is already set up correctly so it's just a matter of loading the null program without disturbing the state.

Joshua

Posted 2015-10-02T17:20:15.947

Reputation: 3 043

1

Codan, 4 bytes

«»

All loops in Codan are infinite if they don't have breaks. This program is transpiled to C as follows:

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <termios.h>
int main(void)
{
    int mem[10000];
    int alpha, beta, t;
for (;;) {
}

    return 0;
}

LegionMammal978

Posted 2015-10-02T17:20:15.947

Reputation: 15 731

1

PRINDEAL, 10 bytes

a t
 t
 t
 t
t

Creates a command named t that calls itself, then calls itself regardless of whether the first call suceeded. An interpreter was posted which does not use recursion, and thus will keep running forever (or until it runs out of memory)

pppery

Posted 2015-10-02T17:20:15.947

Reputation: 3 987

1

Revaver2pi, 5 bytes

TEL 0

TEL searches (cyclically) for the next TEL with the same first argument and jumps to there.

LegionMammal978

Posted 2015-10-02T17:20:15.947

Reputation: 15 731

1

XRF, 5 bytes

FFFFF

Only contains one chunk, which is a NOP. The instruction pointer is the top of the stack, so it never changes and just repeats the code infinitely.

LegionMammal978

Posted 2015-10-02T17:20:15.947

Reputation: 15 731

1

Sonic Pi

loop do end

I think that's easy to understand.

Mega Man

Posted 2015-10-02T17:20:15.947

Reputation: 1 379

1

ACIDIC, 1 byte



A single newline character. In the C# interpreter, the empty program (i.e., the second line) just loops forever.

LegionMammal978

Posted 2015-10-02T17:20:15.947

Reputation: 15 731

1

Enigma-2D, 2 bytes

RL

The IP alternates between moving rightwards and leftwards.

LegionMammal978

Posted 2015-10-02T17:20:15.947

Reputation: 15 731

1

MarioLANG(4 Bytes)

><
==

user54200

Posted 2015-10-02T17:20:15.947

Reputation:

1

There is already a shorter solution in the same language.

– Mego – 2016-07-02T02:33:26.453

1

Nim, 16 bytes

while on:discard

on is an alias for true. Nim disallows expressions that aren't explicitly discarded, so we just discard nothing.

Copper

Posted 2015-10-02T17:20:15.947

Reputation: 3 684

1

Logicode, 24 bytes

circ r(a)->r(a)
out r(1)

Logicode is a new language that I made recently. It only consists of the basic logic gates AND, OR and NOT.

It also contains some nifty stuff like conditionals, make-your-own circuits, and output.

Basically, the first line declares a new circuit, r, with an argument a, and declares the output of the circuit to be r(a). This basically results in an infinite loop.

out r(1) outputs r(1).

clismique

Posted 2015-10-02T17:20:15.947

Reputation: 6 600

1

Ru, 4 bytes

¿Ϟ{}

¿ call a function while koppa is not 0/nil/false. But since Ϟ also return its argument, it's possible to chain ¿ and Ϟ.

TuxCrafting

Posted 2015-10-02T17:20:15.947

Reputation: 4 547

1

Emotinomicon, (2 chars) 6 bytes

ℹ⏩

I cleverly chose the character for 3 bytes instead of 4. Explanation:

ℹ⏩ explanation
ℹ  push the imaginary unit to the stack
 ⏩ close loop

It works, because 1) has got a value (i) 2) can't find a .

To test the code, do the following:

  1. Open the interpreter.
  2. Clean the box and then put a in it (not part of the code, just in case you have a dirty output stream).
  3. Paste the code after that one-big-toothed strange guy.
  4. Click on "generate explanation". Watch the steps done there (also, no mono-spacing issues).
  5. Click on "submit". Warning: the code will run after this step!

Erik the Outgolfer

Posted 2015-10-02T17:20:15.947

Reputation: 38 134

You're shown in the Leaderboard as 2 bytes. Also why non competing? – Roman Gräf – 2016-10-16T08:07:04.900

@RomanGräf The language was made in December 2015, this challenge is from October 2015. – Erik the Outgolfer – 2016-10-16T08:16:52.627

WHY is this question still active???? – Roman Gräf – 2016-10-16T08:19:25.310

@RomanGräf Because I just edited my answer. Dunno why I put non-competing in there, though... – Erik the Outgolfer – 2016-10-16T08:20:11.503

1

Racket 18 bytes

(λ()(let g()(g)))

rnso

Posted 2015-10-02T17:20:15.947

Reputation: 1 635

1

D2, 3 bytes

+[]

Same as Brainfuck

More interesting version using the preprocessor (the code is actually never executed because the infinite loop is in the preprocessor):

(@a)a@a

Simple recursive macro

TuxCrafting

Posted 2015-10-02T17:20:15.947

Reputation: 4 547

0

7, 3 bits, represented as 1 byte on disk (language postdates challenge)

1

Try it online!

This is fairly simple. The program starts by pushing 7 onto the stack (which is what 1 does); then when the end of the program is reached, the top nonempty stack element is executed, without removing it from the stack (although any empty elements above it are removed). 7 just pushes an empty stack element to the stack, which immediately gets removed as it's the end of the program, and so nothing has changed and the same stack element just gets run again, repeatedly.

user62131

Posted 2015-10-02T17:20:15.947

Reputation:

0

SmileBASIC, 5 bytes

EXEC.

. is the same as 0.0, so it runs EXEC 0, which executes the program stored in slot 0, which is the default slot.

Example use:

PRINT TIME$
WAIT 1
EXEC.

12Me21

Posted 2015-10-02T17:20:15.947

Reputation: 6 110

0

Pari/GP , 9 Bytes

while(1,)             

(dummy text such that SE accepts the answer)

Gottfried Helms

Posted 2015-10-02T17:20:15.947

Reputation: 201

0

PKod - 1 byte

Version 1.1 was released very recently as I still update this, which implements this new function/command

<
Explanation: Jumps back to first byte in code. So it jumps back to itself. Normally meant to be used with test cases (e.g.: if prime, jump back to start - iterate all code again, but since thread asks for infinite loop, why not)

Alternative version, 4 bytes:

-+ia
Explanation: -+ , remove then add 1 to value. Thus value keeps jumping from 0 and 1. "i" jumps two blocks back in code until value is next char after "i". Thus until char is 1. Thus until value reaches ascii code of a which is 97. Which never happens

P. Ktinos

Posted 2015-10-02T17:20:15.947

Reputation: 2 742

0

Chip, 5 bytes

*S

+3 for -w on the command line, which allows the program to run without reading from stdin. Instead, it uses an internal source (generating 0x00 repeatedly by default).


* is a constant high signal; this turns on adjacent elements.
S when powered, suppresses output for the current cycle.

Phlarx

Posted 2015-10-02T17:20:15.947

Reputation: 1 366

I believe the first flag (-w) is considered 3 bytes (but the following flags will be considered 1 byte each) – user41805 – 2017-01-30T17:12:53.277

You are right! I wasn't certain to start with, and your comment forced me to do research on the accepted norms. – Phlarx – 2017-01-30T17:22:29.520

Do you need the -w flag? The consensus is that you can assume STDIN is empty.

– Esolanging Fruit – 2017-07-10T00:08:53.837

@Challenger5 The problem here is that, by default, Chip terminates when it has processed all of stdin. Empty stdin means that Chip will terminate immediately. – Phlarx – 2017-07-10T15:14:49.007

0

BitCycle, 3 bytes

>1<

Places a 1 bit on the playfield and infinitely moves it back and forth between the > < devices.

DLosc

Posted 2015-10-02T17:20:15.947

Reputation: 21 213

0

AWK, 1 byte

0

If I've read the rules correctly, this satisfies the constraints. If we run the code without input, as stipulated, it will be in an infinite loop processing its nonexistent input, forever. If you happen to give it some input, it won't print it.

Usage:

awk '0'

Using an END label is equivalent to this, regardless of what is attached to label, as it requires some input in order to be executed.

The smallest code that doesn't look for input would be (in my version of gawk):

BEGIN{for(;;)1}

I tried without the 1 and AWK wasn't happy.

Robert Benson

Posted 2015-10-02T17:20:15.947

Reputation: 1 339

0

ezfuck, 2 bytes

+{

Basically equivalent to +[] in BrainFuck.

+ increments the current cell to 1, then { jumps back a single command while the current cell is non-zero.

Non-competing since I only wrote the language 3 days ago.

Carcigenicate

Posted 2015-10-02T17:20:15.947

Reputation: 3 295

The "non-competing" rule has been lifted, which means that this is a competing submission. – Esolanging Fruit – 2017-07-09T23:49:41.510

@Challenger5 Oh, thanks. Are you sure? It doesn't say in the question that new languages are allowed. – Carcigenicate – 2017-07-09T23:53:46.780

Marking as NC was the default for newer languages, but it was changed after a recent meta discussion

– Esolanging Fruit – 2017-07-10T00:00:38.623

@Challenger5 Awesome, thank you for pointing me to that page! That's certainly a welcome change – Carcigenicate – 2017-07-10T00:03:56.283

0

Unreadable, 25 bytes

'"""""'"""'""""""'"""'"""

Try it online!

Explanation

'"""""                       While X is true, do Y
      '"""                   [X] - Return 1
          '""""""            [Y] - Set variable X to value Y
                 '"""           [X] - Return 1
                     '"""       [Y] - Return 1

Skidsdev

Posted 2015-10-02T17:20:15.947

Reputation: 9 656

4Explanation? Also, you haven't formatted it correctly, it should be '"""""'"""'""""""'"""'""". – Esolanging Fruit – 2017-07-09T23:48:28.850

0

MOO, 30 28 26 bytes

while(!suspend(0))endwhile

The suspend(0) is necessary to avoid "task ran out of ticks'

pppery

Posted 2015-10-02T17:20:15.947

Reputation: 3 987

Do you need the spaces? – Esolanging Fruit – 2017-07-09T23:48:00.160

No. I don't. Good point. – pppery – 2017-07-09T23:49:36.977

0

XSLT, 173 bytes

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"><xsl:template name="a" match="/"><xsl:call-template name="a"/></xsl:template></xsl:stylesheet>

Requires a trivial XML file as input (<root /> will suffice), since XSLT won't actually do anything unless given input. You can test it here. It's possible to remove some of the spaces or the xmlns:xsl attribute and still have it parse, but most XSLT lint programs will reject the shorter versions, so this is the shortest "correct" XSLT script I could come up with that loops forever.

Silvio Mayolo

Posted 2015-10-02T17:20:15.947

Reputation: 1 817

0

Newline, 3 bytes

i[]

Same as brainfuck answer. Adds one and loops

[i]

also works

{} 

works only if loops[0]=infinity

Christopher

Posted 2015-10-02T17:20:15.947

Reputation: 3 428

0

Cubically, 2 1 byte

)

This should not work, but it does due to how the interpreter handles the number of loops. With no jump points, ) jumps to the beginning of the file, which is )... cue infinite loop.

This is the proper version that will work if I fix the interpreter:

()

( can be jumped to if all provided arguments are truthy (none are provided so they all are). ) can jump back to the most recent ( if all provided arguments are truthy. Once again, none provided so it jumps regardless.

MD XF

Posted 2015-10-02T17:20:15.947

Reputation: 11 605

0

Implicit, 1 byte

(

Creates a jump point. When the interpreter hits EOF and there is an open jump point, it loops forever.

MD XF

Posted 2015-10-02T17:20:15.947

Reputation: 11 605

0

Nhohnhehr, 11 bytes

+-+
|$|
+-+

Try it online!

Erik the Outgolfer

Posted 2015-10-02T17:20:15.947

Reputation: 38 134

0

jq 1.5, 13 bytes

until(null;1)

this also works but is no shorter:

repeat(empty)

jq170727

Posted 2015-10-02T17:20:15.947

Reputation: 411

0

Chip-8, 1 byte

0x12

Instructions in Chip-8 are 2 bytes, so 0x12 is interpreted as 0x1200 (assuming the unused parts of the program are filled with zeros)

Instruction 0x1... jumps to the address stored in the lower 1.5 bytes, which is 0x200, the start of program memory.

12Me21

Posted 2015-10-02T17:20:15.947

Reputation: 6 110

0

4, 12 bytes

3.6147281494

Try it online! (Note: The interpreter used by TiO raises an error with this code. This is caused by the interpreter, not the program itself)

Explanation (According to the wiki specifications):

3.         Start program
6 14 72    Set memory cell 14 to 72
8 14       While cell 14 != 0
9          End while
4          End program

KSmarts

Posted 2015-10-02T17:20:15.947

Reputation: 1 830

Do you have an interpreter on which this program works? – FlipTack – 2017-11-16T07:36:06.413

@FlipTack I think this should work, but I can't test it right now.

– KSmarts – 2017-11-16T15:12:47.357

0

Hodor, 22 bytes

hodor............(1){}

Hodor!

Or, (44 bytes)

hodor............(hodor. rhodor!? hodor? ){}

KSmarts

Posted 2015-10-02T17:20:15.947

Reputation: 1 830

0

Smalltalk-80, 8 bytes

(or more)

First there is no such thing as a program in Smalltalk-80, just write a snippet anywhere in a text pane and press the doIt! pop up menu. But we can eventually write snippets that don't stop.

[]repeat

is the obvious infinite loop

thisContext restart

is our kind of goto solution

|x|
x:=[:b|b value: b].
x value:x

is a block closure evaluating itself recursively, but since a closure close over local variables, we can do it shorter:

|b|(b:=[b value])value

Since Smalltalk-80 don't do recursive tail elimination, this infinite loop will starve memory and won't really be infinite.

We also may retry code that raised an exception, if ever the exception was temporary...
(a costly variant of repeat)

[0halt]on:Halt do:[:e|e retry]

We can also play with recursive structures, modulo recursive tail elimination problems:

|x|(x:=1->0)key:x;hash

We can also exploit weaknesses of the interpreter itself - this is in latest Squeak 6.x (you'll have to kill the image):

|c|c:=Class new.c superclass:c.c new

Since new will invoke self basicNew initialize, the interpreter will loop in #initialize method lookup. This time no memory growth, the loop is solid.

There must be some shorter exploit, but I'll stop here, Smalltalk is more talk than small for golfing...

In a certain sense, the interpreter performs an infinite loop itself, so doing nothing is already doing an infinite loop, but that's cheating.
In the case of Smalltalk though, since we save the state of the interpreter in an image, and later resume an image at each restart, we're just running the infinite loop for more than 20 years now (or one of its avatars). Since it's ran over a virtual machine, it even perpetuates across different machines, OS, architectures, so it's a quite robust loop!

aka.nice

Posted 2015-10-02T17:20:15.947

Reputation: 411

0

Operation Flashpoint scripting language, 4 bytes

@0>1

@ waits until the condition (0>1) is true, which obviously never happens, so it keeps looping and checking the condition forever.

Alternative solution (10 bytes):

#l
goto"l"

This usually freezes the game.

Steadybox

Posted 2015-10-02T17:20:15.947

Reputation: 15 798

0

REXX, 10 bytes

s:signal s

Of course, the canonical way is a whopping 14 bytes:

do forever
end

Or, depending on implementation:

do forever
nop
end

idrougge

Posted 2015-10-02T17:20:15.947

Reputation: 641

0

Whispers, 16 bytes

> 1
>> While 1 1

Try it online!

caird coinheringaahing

Posted 2015-10-02T17:20:15.947

Reputation: 13 702

0

Acc!!, 21 bytes

Count i while i+1 {
}

Try it online!

In Acc!!, looping is costly. Whitespace between brackets is required and the statement is a bit wordy. This is pretty self-explanatory, but just in case, it increments i until i - (i + 1) = 0, which is never.

FantaC

Posted 2015-10-02T17:20:15.947

Reputation: 1 425

0

Pyt, 3 bytes

1`ł

Explanation:

1             Pushes 1 onto the stack
 `ł           Loops while the top of the stack is not zero

Try it online!

mudkip201

Posted 2015-10-02T17:20:15.947

Reputation: 833

0

Forked, 0 bytes



Same as the top two answers. Try it online!

MD XF

Posted 2015-10-02T17:20:15.947

Reputation: 11 605

0

Wumpus, 0 bytes

Try it online!

Another 0 byte 2D entry. In Wumpus, the first cell is implicitly created, the pointer is always out of bounds, so it reflects forever.

Jo King

Posted 2015-10-02T17:20:15.947

Reputation: 38 234

I'd have to double check the code, but I think the first cell isn't actually created. Instead the grid has dimensions 0x1 so that the IP is always out of bounds (and then still bounces around the edges of its current OOB cell forever). – Martin Ender – 2018-02-13T10:03:28.990

0

Momema, 4 bytes

j0j1

Try it online!

Explanation

j  0  #  label j0: jump past label j0 (no-op)
j  1  #  label j1: jump past label j0 (re-execute this instruction)

Esolanging Fruit

Posted 2015-10-02T17:20:15.947

Reputation: 13 542

0

FALSE, 5 bytes

[1]$#

Explanation:

[ {function start}
 1 {push 1}
] {push function}
$ {duplicate}
# {while loop: pop two functions, run them while the first returns true}

This will quickly use up memory since the body function of the while loop pushes a value which is never popped.

Here's one of the same size which doesn't cause a memory leak, but only works on certain interpreters/compilers:

[1]1#

The second 1 is read as a function pointer, which causes the while loop to jump to the ], skipping the other 1.

12Me21

Posted 2015-10-02T17:20:15.947

Reputation: 6 110

0

Stax, 1 byte

W

Try it online!

Just an unconditional loop without body.

Weijun Zhou

Posted 2015-10-02T17:20:15.947

Reputation: 3 396

0

axo, 1 byte

_

Try it online!

_  goes to the command at 0,0, which happens to be _

FantaC

Posted 2015-10-02T17:20:15.947

Reputation: 1 425

0

PHP 7, 8 bytes

for(;;);

This is the shortest I could think of, it's one shorter then

while(1);
//and
a:goto a;

Try it online

it's 5 more if you count the <?php tag

ArtisticPhoenix

Posted 2015-10-02T17:20:15.947

Reputation: 329

0

uBASIC, 7 bytes

1Goto1:

Try it online! Version that produces output may be seen Here

Taylor Scott

Posted 2015-10-02T17:20:15.947

Reputation: 6 709

0

VBA, 7 Bytes

Anonymous VBE immediate window that takes no input and loops forever

Do:Loop 

Taylor Scott

Posted 2015-10-02T17:20:15.947

Reputation: 6 709

0

Yabasic, 7 bytes

Anonymous Function that takes no input and loops forever.

Do:Loop

Try it online! A version that infinitely outputs 1 may be seen here.

Taylor Scott

Posted 2015-10-02T17:20:15.947

Reputation: 6 709

You might as well combine this answer with your VBA answer, given that they're identical. – caird coinheringaahing – 2018-02-12T20:37:45.170

0

MY-BASIC, 12 bytes

Anonymous While loop that loops forever.

While 1
Wend

Try it online! A version that prints 1 infinitely may be seen here.

Taylor Scott

Posted 2015-10-02T17:20:15.947

Reputation: 6 709

0

Visual Basic .NET (.NET Core), 44 bytes

Declare Subroutine that takes no input and loops forever.

Module M
Sub Main
Do
Loop
End Sub
End Module

Try it online! A version that outputs 1 infinitely may be seen here.

Taylor Scott

Posted 2015-10-02T17:20:15.947

Reputation: 6 709

0

Pain-Flak, 8 bytes

))((})({

Try it online!

Explanation:

))(( pushes 1 on stack
})({ the }...{ loops until TOS = 0 and the )( makes it run as a loop because without the )( the }...{ would eval as }{ and not loop
The code is flipped and added to the end during Pain-Flak interpreting and the code does a infinite loop again. 

Christopher

Posted 2015-10-02T17:20:15.947

Reputation: 3 428

Note I found the Brain-Flak answer after I wrote this. This was not just a cheap port :P – Christopher – 2018-03-01T19:12:45.733

0

So I suppose I can create a new language and develop its intepreter for this answer, can't I?

Feel free to use a language (or language version) even if it's newer than this challenge. -Note that there must be an interpreter so the submission can be tested. It is allowed (and even encouraged) to write this interpreter yourself for a previously unimplemented language. :D

Ghrvy...!, 3 bytes

grv

Intepreter written in Python 3

Explanation first (Syntax and functions please see below)

g            # Add 1 to the 1st cell
 r           # Loop when 1st cell != 0
  v          # Switch between cell manipulation and pointer manipulation
             # Implicit end of loop. Since 1st cell is still 1, voilà, infinite loop.

Ghrvy...! is a new programming language developed just after I finished golfing my answer in the challenge Non discriminating programming that I at first typed a lot of ghrvys in the code to meet the requirements. Since it is inspired by brainfuck, it is also the type of cell-pointer esolang. All programs in brainfuck can be transpiled to this language.

Syntax:

`g`: aGaru  - increase the pointer / value in current cell by 1.
              Affects the value by default.
              (Japanese for 'going up')
`h`: Heru   - decrease the pointer / value in current cell by 1.
              Affects the value by default.
              (Japanese for 'becoming less')
`r`: Repeat - repeat the next code block (block with indent 
              greater than the indent of the line where the `r` 
              token is on) if r is the last command of the same 
              line, or else repeat the remaining code on the same 
              line, when the value in current cell is non-zero.
`v`: Value  - switch the target of tokens `g` and `h` between the
              pointer and the value at the pointer.
`y`: Yee    - Set the value in current cell to a random number in
              the range [0, value in next cell] inclusive.
`.`: Input  - Get a byte from user input and set the value in
              current cell to that byte. Supports UTF-8.
`!`: Output - Output value in current cell as a byte in UTF-8. 
              The program will wait for a valid UTF-8 
              representation to output.
Spaces(` `) - No meaning when between commands on a line, act as
              indentation when at the beginning of a line.
Newlines    - Split code blocks, no meaning.

Since there must be something after the token r and token v does no pointer , cell and I/O manipulations, the program grv can be transpiled to brainfuck as +[].

Messages in the STDERR generated are those generated by the intepreter. No actual output is generated by the Ghrvy...! program itself.

Well, I came up the idea of the language first, and found this challenge may be a good place to show the features ;)

Shieru Asakoto

Posted 2015-10-02T17:20:15.947

Reputation: 4 445

0

Sceql, 3 bytes

Make the current byte non-zero, then loop forever. I use this implementation to verify it.

-\/

Weijun Zhou

Posted 2015-10-02T17:20:15.947

Reputation: 3 396

0

mIRC v.7.49, 18 16 13 bytes

y while (1) y

This produces an infinite loop when no input is given.

The code is written in the mirc alias window, and to use it, just write /y in any chat window or status window. Also note that mIRC freezes when an infinite loop is encountered.

Manish Kundu

Posted 2015-10-02T17:20:15.947

Reputation: 1 947

0

Python 3, 37 bytes

Hope I did this correctly

try:
    while 1:pass
except:pass

Try/Except will end program when memory runs out.

Mercury Platinum

Posted 2015-10-02T17:20:15.947

Reputation: 161

0

Canvas, 2 bytes

¹[

Try it here!

Explanation:

<num>[<...><}|]|EOL|EOF>: execute <...> <num> times.
¹: float.MaxValue = ∞

hakr14

Posted 2015-10-02T17:20:15.947

Reputation: 1 295

0

Dreaderef, 5 bytes

1 9-1

Try it online!

Explanation

deref 9 -1 ; put value of cell 9 (initially 0) into cell -1, the instruction pointer

The 9 could have been replaced with any integer except -1, 0, or 2.

Esolanging Fruit

Posted 2015-10-02T17:20:15.947

Reputation: 13 542

0

Reflections, 5 bytes

v\
\/

Test it!

Explanation:

  • v reflects the IP down
  • \ reflects the IP right
  • / reflects the IP up
  • \ reflects the IP left
  • v reflects the IP down into the loop again

wastl

Posted 2015-10-02T17:20:15.947

Reputation: 3 089

0

Japt, 1 byte

Assumes an unlimited call stack.

ß

Test it

Shaggy

Posted 2015-10-02T17:20:15.947

Reputation: 24 623

0

MachineCode, 5 4 bytes

ebfe

This executes the machine code EB FE (JMP -2); -2 (0xFE) is the length of the instruction.

Try it online!

MD XF

Posted 2015-10-02T17:20:15.947

Reputation: 11 605

0

Tamsin, 10 bytes

main={''}.

Try it online!

Esolanging Fruit

Posted 2015-10-02T17:20:15.947

Reputation: 13 542

0

Idris, 19 bytes

main:IO()
main=main

Haskell solution + type signature.

Mega Man

Posted 2015-10-02T17:20:15.947

Reputation: 1 379

0

ink, 7 bytes

-(i)->i

Try it online!

Sara J

Posted 2015-10-02T17:20:15.947

Reputation: 2 576

0

Crystal, 6 bytes

loop{}

The loop keyword takes a block, which is here denoted by the curly brackets. I'm not sure I've seen any "real" (intended for use) Crystal code that uses loop instead of while, but I'd expect it to be used in the expanded form:

loop do
  # do something here
end

Kinxer

Posted 2015-10-02T17:20:15.947

Reputation: 31

0

Aheui, 0 byte.


Since Aheui is befunge-like, this is infinite loop.

LegenDUST

Posted 2015-10-02T17:20:15.947

Reputation: 799

0

VTL-2, 7 bytes

2 #=1

# is the system variable in VTL-2 for line numbers, and it works to retrieve a line number or as a GOTO if given an assignment. So this is a trivial GOTO loop. The one interesting thing about it is that VTL-2 doesn't actually let you GOTO the current line number. It does GOTO the next largest line number when given a nonexistent line, however, so a one-line infinite loop will always work given that y is less than x for the program x #=y.

brhfl

Posted 2015-10-02T17:20:15.947

Reputation: 1 291

0

Forget, 37 bytes

const 0x0 1;cleanse 0x0;while 0x0;end

TIO

Benjamin Urquhart

Posted 2015-10-02T17:20:15.947

Reputation: 1 262

What makes this non-competing? Languages created after the challenge are allowed. – TheOnlyMrCat – 2019-08-07T08:26:25.193

@TheOnlyMrCat I guess things have changed – Benjamin Urquhart – 2019-08-07T17:08:22.900

0

33, 4 bytes

Yes, this is a very simple answer:

1a[]

Nothing short of outright hardware failure will stop this from running. Or, y'know, stopping the program.

TheOnlyMrCat

Posted 2015-10-02T17:20:15.947

Reputation: 1 079

0

GOLANG : 32 Bytes

package main;func main(){main()}

One more solution :

package main;func main(){for{}}

dilwaria

Posted 2015-10-02T17:20:15.947

Reputation: 1

1

Welcome to Code Golf! You can eliminate two of the spaces. Try it online!

– Dennis – 2019-08-07T13:18:55.277

0

Oasis, 2 bytes

1b

TIO

Explanation

1  Starting from a(1)
 b Recurse all the way down (i.e. do a(n-1))

user85052

Posted 2015-10-02T17:20:15.947

Reputation:

0

Stax, 1 bytes

G

Run and debug it

G goes to the beginning of the program...

user89655

Posted 2015-10-02T17:20:15.947

Reputation: 31

0

ABC (Esoteric), 1 byte

l

Loops back to the beginning.

user85052

Posted 2015-10-02T17:20:15.947

Reputation:

0

And, 0 bytes


No && exit, therefore loops forever.

user85052

Posted 2015-10-02T17:20:15.947

Reputation:

0

A0A0, 2 bytes

G0

Goes 0 lines below the current line.

user85052

Posted 2015-10-02T17:20:15.947

Reputation:

0

Fastlane, 0 bytes


The pointer speed defaults to 1 and wraps around; there isn't a $ instruction to halt the pointer in this program.

user85052

Posted 2015-10-02T17:20:15.947

Reputation:

0

@, 2 bytes

¤

Loops forever, takes arbitary input and has no output.

user85052

Posted 2015-10-02T17:20:15.947

Reputation:

0

><>, 0 bytes


Explanation

There's no ; instruction to halt the program, so it runs forever.

Sagittarius

Posted 2015-10-02T17:20:15.947

Reputation: 169

It may not work on every interpreter (it doesn't work on tio.run), but it seems to work on http://www.fishlanguage.com/

– mbomb007 – 2019-09-07T17:15:31.377

@mbomb007 yeah, I only tested it on fishlanguage.com

– Sagittarius – 2019-12-24T01:07:48.153

0

///, 3 bytes

///

Try it online!

Explanation

This replaces nothing with nothing. It runs forever because when it replaces nothing with nothing, it has to replace that nothing with another nothing, and it does this indefinitely.

Sagittarius

Posted 2015-10-02T17:20:15.947

Reputation: 169

This is a duplicate of this answer: https://codegolf.stackexchange.com/a/59578/

– DanTheMan – 2019-09-07T21:03:04.977

ah, didn't see a /// submission, thx – Sagittarius – 2019-12-24T01:06:48.330

0

QWOP, 2 bytes

OO

Explanation

The command O return[s] the pointer to the last O, if one exists. So this will run indefinitely without producing output.

Sagittarius

Posted 2015-10-02T17:20:15.947

Reputation: 169

0

Kipple (cipple), 6 5 bytes

1>a(a

Pretty simple, just pushes 1 to stack A, and then begins a loop that only ends if stack A is empty

-1 byte, since the ending bracket isn't necessary in cipple for some reason

Try it online!

EdgyNerd

Posted 2015-10-02T17:20:15.947

Reputation: 1 106

0

Element, 3 bytes

!{]

Negates top of stack & executes while.

TIO

user85052

Posted 2015-10-02T17:20:15.947

Reputation:

0

Rust, 17 bytes

fn main(){loop{}}

Just for fun :P

Sagittarius

Posted 2015-10-02T17:20:15.947

Reputation: 169

What's "just for fun" about this answer? – pppery – 2020-01-07T00:18:40.533

@pppery I mean that it's not in order to win anything, I'm just submitting it for fun – Sagittarius – 2020-01-13T14:44:13.683

0

International Phonetic Esoteric Language, 3 bytes (WIP language)

ɘ0e

What the code does is push 0, then check if the stack is falsy, which 0 is. Then it jumps, without any output.

No TIO interpreter yet, but is runnable by cloning the repository above, and calling python3 main.py "code here".

ɘ0e
ɘ   ; begin falsy jump
 0  ; push 0
  e ; pop, if falsy jump; else end falsy jump

bigyihsuan

Posted 2015-10-02T17:20:15.947

Reputation: 1 483

0

Whenever: 4 bytes

1 1;

Is actually an example from the specification. The instruction causes line 1 to put itself back on the to-do list.

AlienAtSystem

Posted 2015-10-02T17:20:15.947

Reputation: 488

0

NULL, 2 bytes

41

Code in the NULL language is a number.

The interpreter sets X = 41 and Y = 1. Afterwards, it divides X by its smallest prime factor (41) and multiplies Y by that, so then X = 1 and Y = 41.

Afterwards, it performs an action which corresponds to that prime factor. The action for 41 is to swap X and Y, so X = 41 and Y = 1.

The program ends when X = 1, which will never happen with this code.

anatolyg

Posted 2015-10-02T17:20:15.947

Reputation: 10 719

0

Intcode, 5 bytes

5,0,1

This is too short.

pppery

Posted 2015-10-02T17:20:15.947

Reputation: 3 987

0

tq, 3 bytes

"")

Explanation

"",  # Define an empty string
   ) # Extend the list forever

user85052

Posted 2015-10-02T17:20:15.947

Reputation:

0

C++ Template Meta-Programming, 48 bytes

template<int n>class S{enum{v=S<n-1>::v}}S<1>::v

There is an infinite loop in the template, so this doesn't compile. Other stuff that doesn't compile, but doesn't need to for the template to recurse (S being private, S<1>::v being free floating)

Can be run at http://coliru.stacked-crooked.com/ for error g++: internal compiler error: Segmentation fault

g++ -std=c++14 -O2 -Wall -pedantic -pthread -ftemplate-depth=162345 main.cpp && ./a.out

Nathan Cooper

Posted 2015-10-02T17:20:15.947

Reputation: 617

Not sure if that is compliant with the rules as it doesn't run out of memory when it stops. If you want to do that, there is the -ftemplate-depth compiler option in gcc that allows you to set the recursion depth to something very high so you'll at least get a segfault out of it. – iFreilicht – 2015-10-16T14:23:19.333

@iFreilicht Yeah, I suppose you're right. I couldn't (be bothered to...) find a online complier that supported that. – Nathan Cooper – 2015-10-16T14:33:09.023

1http://coliru.stacked-crooked.com – iFreilicht – 2015-10-16T14:35:14.307

0

HPPPL, 16 bytes

while 0=0 do end

M L

Posted 2015-10-02T17:20:15.947

Reputation: 2 865

0

Univar, 8 bytes

($,,)$,,

Self-calling function.

LegionMammal978

Posted 2015-10-02T17:20:15.947

Reputation: 15 731

Seems too recursive to me... is there any tail-call optimization? – Erik the Outgolfer – 2016-09-25T13:57:30.683

@EriktheGolfer Not at my computer right now, but I believe that the interpreter internally uses a variable-length list for the call stack. – LegionMammal978 – 2016-09-25T14:03:14.737

0

x86 Machine code, 2 bytes

Machine Code

     00 01
0000 73 FE

Asm source

[SECTION .text]
[bits 16]
[org 0x100]

EntryPoint:
    jnc     EntryPoint

Both the jmp and the call instructions use a 1 byte op-code followed by a 2 byte absolute offset. Conditional jumps on the other hand, are limited to a destination within [+127, -128] bytes of the branch. This is because they are encoded with a 1 byte op-code and a 1 byte relative offset. Dos already cleared the flags before invoking our program, so we know the carry flag will be clear and facilitate an endless (non-crashing) loop. We wont run out of stack-space, which would result in a stack-overflow error, or overwriting and ultimately crashing, our program. Approaches using call will suffer this after about 32,638 iterations. (stack is initally 0xFFFE, (3 byte) program begins at 0x100, each iteration decrements the SP by 2.)

enhzflep

Posted 2015-10-02T17:20:15.947

Reputation: 227

0

ROOP, 1 byte

1

At the beginning, the number 1 is converted to an object that contains the number. As there is no operator and the object has nowhere to move, it always happens the same: nothing. The program does not end because there is an existing object.

DarkPhantom

Posted 2015-10-02T17:20:15.947

Reputation: 191

2An explanation would make this a more complete answer. – Alex A. – 2015-12-24T03:29:40.540

0

Befalse, 7 bytes

A two dimensional language.

Extremely straightforward; the ! unconditionally skips the next instruction and the / and \ reflect intuitively.

!/\
 \/

cat

Posted 2015-10-02T17:20:15.947

Reputation: 4 989

0

Etre, 2 bytes

()

The program sets the first cell to 1, then loops while it isn't zero.

LegionMammal978

Posted 2015-10-02T17:20:15.947

Reputation: 15 731

0

Skull, 8 bytes

for(;;);

Uses a bug in the Skull2C transpiler, where unrecognized expressions are converted directly into C.

LegionMammal978

Posted 2015-10-02T17:20:15.947

Reputation: 15 731

0

KimL, 14 bytes

A:
ctrl.goto A

For whatever reason, labels must come before the lines that they label.

LegionMammal978

Posted 2015-10-02T17:20:15.947

Reputation: 15 731

0

Perl 6, 7 bytes

loop {}

but...

> loop{}
===SORRY!=== Error while compiling <unknown file>
Whitespace required after keyword 'loop'
at <unknown file>:1
------> loop⏏{;}

k.

cat

Posted 2015-10-02T17:20:15.947

Reputation: 4 989

0

Perl 5, 9 bytes

while(){}

boooooooooooooooooooooooooooooooooooooooooring.

cat

Posted 2015-10-02T17:20:15.947

Reputation: 4 989

0

Postscript, 6 bytes

{}loop

Infinite loop that does nothing. Ties up 1 core at 100% when run under ghostscript. Interestingly, the ghostscript interpreter keeps accepting input, so it must be running a separate thread. Not sure what would happen if this was sent to a printer, though.

Zakipu

Posted 2015-10-02T17:20:15.947

Reputation: 493

0

Oracle PL/SQL 11.2, 30 bytes

BEGIN LOOP NULL;END LOOP;END;/

Jeto

Posted 2015-10-02T17:20:15.947

Reputation: 1 601

0

Magic, 7 bytes

skip -1

A simple self-GOTO.

LegionMammal978

Posted 2015-10-02T17:20:15.947

Reputation: 15 731

0

NTFJ, 2 bytes

Try it here!

~^

This is stiflingly simple. ~ pushes a 0 to the stack, and ^ pops N and goes that position in the source code. The simplest unconditional loop in NTFJ is this.

Conor O'Brien

Posted 2015-10-02T17:20:15.947

Reputation: 36 228

0

GNU Make, 16 bytes

f=$(call f)
$(f)

The loop is in make itself, not a program it invokes.

ugoren

Posted 2015-10-02T17:20:15.947

Reputation: 16 527

0

ForceLang, 9 bytes

Works by abusing the new def instruction.

def a a
a

Original 14-byte answer:

label l
goto l

SuperJedi224

Posted 2015-10-02T17:20:15.947

Reputation: 11 342

0

Pylons, 4 bytes.

w,1}

Loops while 1 is true.

Morgan Thrapp

Posted 2015-10-02T17:20:15.947

Reputation: 3 574

0

Zach Gates

Posted 2015-10-02T17:20:15.947

Reputation: 6 152

0

Mathcad, 4 "bytes"

enter image description here

In Mathcad the user enters programming language commands using keyboard shortcuts (or picking them from the Programming Toolbar) rather than writing them in text. For example, typing ctl-] creates a while-loop operator that has two "placeholders" for entering the condition and a single line of the body, respectively. Typing = at the end of a Mathcad expressions causes Mathcad to evaluate the expression.

So to enter the above while loop, the user enters "ctl-]11=". Mathcad will then eternally evaluate 1.

Stuart Bruff

Posted 2015-10-02T17:20:15.947

Reputation: 501

0

Come Here, 11 bytes

1COME FROM1

SuperJedi224

Posted 2015-10-02T17:20:15.947

Reputation: 11 342

0

WhoScript, 4 bytes

1v;d

The 1 tells the interpreter to use one-line mode, v starts an infinite loop, and d loops back to the v.

MCS-Kaijin

Posted 2015-10-02T17:20:15.947

Reputation: 109

0

Cy, 8 bytes 6 bytes

{1} do

Explanation:

{1} is a block (procedure) that pushes 1 to the stack (truthy). do will continue to execute that block until it pushes something falsy to the stack, which will never happen.

Cyoce

Posted 2015-10-02T17:20:15.947

Reputation: 2 690

0

MNNBFSL, 4 bytes

[[<]

A bit complicated. Read the Esolangs page for more information.

LegionMammal978

Posted 2015-10-02T17:20:15.947

Reputation: 15 731

0

Bash, 10 bytes

f(){ f;};f
It does end up crashing the program /bin/bash, but I think that's allowed.

HyperNeutrino

Posted 2015-10-02T17:20:15.947

Reputation: 26 575

0

tinyBF, 5 bytes

+|= |

Similar to +[] in BF. The space is required here, as |=| (meaning []) is converted to ,.

LegionMammal978

Posted 2015-10-02T17:20:15.947

Reputation: 15 731

0

Braille, 6 bytes

⠁⡀

Self-GOTO with a NOP. If it isn't displayed properly (and/or you want to test it):

0000000: e2a0 81e2 a180                           ......

LegionMammal978

Posted 2015-10-02T17:20:15.947

Reputation: 15 731

0

Grocery List, 6 bytes

W
L
E

Note the preceding newline. W pushes 100 to the stack, and L and E loop while the top of stack isn't 0.

LegionMammal978

Posted 2015-10-02T17:20:15.947

Reputation: 15 731

0

Dumbfuck, 2 bytes

.?

. sets the current cell to 1, and ? jumps to itself (due to the cell being an odd number).

LegionMammal978

Posted 2015-10-02T17:20:15.947

Reputation: 15 731

0

Pyke, 1 byte

r

Try it here!

The r node sets the counter to 0, resetting the program.

Blue

Posted 2015-10-02T17:20:15.947

Reputation: 26 661

0

Tellurium, 5 bytes

[i|p]

This is pretty simple to explain. It runs the command p (Does nothing, which is why it's good for this challenge) forever (i = infinity).

m654

Posted 2015-10-02T17:20:15.947

Reputation: 765

0

Glypho, 3 bytes

1[]

Pushes 1 to the stack, then loops while the top of the stack isn't 0. Uses the Java interpreter. This is shorthand for the following "real" Glypho program:

  !" ! " !"!

LegionMammal978

Posted 2015-10-02T17:20:15.947

Reputation: 15 731

0

Churro, 20 bytes

{o}=}{==={*}{===={*}

Consists of three churros. {o}=} pushes 1 to the stack, and {==={*} and {===={*} loop while the top of stack is not zero.

LegionMammal978

Posted 2015-10-02T17:20:15.947

Reputation: 15 731

0

niblet, 2 bytes

 [

The space is just a no-op, and the [ moves the IP to the previous character.

LegionMammal978

Posted 2015-10-02T17:20:15.947

Reputation: 15 731

0

0815, 7 bytes

}: :#: 

(trailing space)

}:0:#:0

Explained:

}:0:    :Create a label 0
    #:0 :Go to the label 0 if Z is 0h

Erik the Outgolfer

Posted 2015-10-02T17:20:15.947

Reputation: 38 134

0

Trigger, 5 bytes

 !  !

Generally, any program with an "ABAAB" pattern should work. toggles the ' ' trigger to 1, ! toggles the '!' trigger, and ! jumps to the nearest ! if the ' ' trigger is 1 (which it is).

LegionMammal978

Posted 2015-10-02T17:20:15.947

Reputation: 15 731

0

Benul, 0 bytes



In Benul, programs are placed in an implicit infinite loop and require special conditions to terminate.

LegionMammal978

Posted 2015-10-02T17:20:15.947

Reputation: 15 731

0

AlphaBeta, 2 bytes

 N

 is a no-op, and N moves the IP to the value stored in the position register (initially 0) if the third register is 0 (which it is).

LegionMammal978

Posted 2015-10-02T17:20:15.947

Reputation: 15 731

0

Java, 50 bytes

interface D{static void main(String[]a){for(;;);}}

Shaun Wild

Posted 2015-10-02T17:20:15.947

Reputation: 2 329

0

Copy, 10 bytes

copy 0 0 1

Copy the current instruction at the next location.

Basically a Core war imp.

TuxCrafting

Posted 2015-10-02T17:20:15.947

Reputation: 4 547

0

LI, 2 bytes

R0

Usually, LI programs (under the current interpreter) always take in input. No input is commonly represented as falsy input, i.e. 0; however, in order to truly accept "no" input, I need to provide my own input to the Recurse function.

Explanation:

R   Recurse with input:
 0  Literal 0

LI, 1 byte

If we're a bit more lax with the input requirements, simply R will work. It doesn't error if you don't give it an input, but that's simply because, while it interprets the input as invalid (empty), it doesn't try to use its value.

Steven H.

Posted 2015-10-02T17:20:15.947

Reputation: 2 841

0

ABCR, 2 bytes

5x

Explanation: 5 loops while the front member of queue B resolves to a truthy value. The default value for queue B is 1, so the loop continues until it finds its matching x; since there are no operations in the loop, it continues ad infinitum with no output.

Steven H.

Posted 2015-10-02T17:20:15.947

Reputation: 2 841

0

Lolo, 20 bytes

lOLolo loLOlo loloLO

You can also put in l at the end, but it won't ever get called.

user47018

Posted 2015-10-02T17:20:15.947

Reputation:

0

Sinclair ZX-81 Basic, 6 bytes

1 RUN

This would take 6 bytes in RAM (2 bytes for the line number, 2 bytes for the line length, 1 byte for the RUN token and 1 byte for a newline).

The way it works is (essentially) the same as the 10 GOTO 10, the first line in the program causes the program to be executed.

Vatine

Posted 2015-10-02T17:20:15.947

Reputation: 161

0

dotsplit, 4 bytes

jump

jump: pops number from stack, moves back that many commands

When the stack is empty, popping results in zero. Hence, it will jump on to the jump command.

In keeping with design principles, the problems this has will not be addressed, but perhaps a new command will be added, called loop-safe or something

Destructible Lemon

Posted 2015-10-02T17:20:15.947

Reputation: 5 908

0

CMD, 2 bytes

Must be in a file named a.bat or a.cmd

@a

Must be in a bat or cmd file

@%0

Roman Gräf

Posted 2015-10-02T17:20:15.947

Reputation: 2 915

2The first answer counts as 3 bytes: 2 for the code, and 1 for the restriction on the filename – user41805 – 2016-11-12T11:37:07.393

Why? He's being punished for a restriction imposed on him by the system, which only recognises specific suffices as executable code. This seems extremely unfair, because it's completely out of his control.

He would not be punished if he used a simple batchfile-editor which would execute the code for him, and thus this punishment is undeserved. – z0rberg's – 2017-01-05T18:30:52.643

0

Visity, 0 bytes

(no code)

As this answer points out Visity wraps around producing an infinite loop.
Or more conventional (2 bytes):

[]

Roman Gräf

Posted 2015-10-02T17:20:15.947

Reputation: 2 915

0

Unary, 695 bytes

695 zeros. Program that prints the actual code can be found here.

Roman Gräf

Posted 2015-10-02T17:20:15.947

Reputation: 2 915

-2

Python: 15 bytes

while 3>1:
    x=1

Robbie Coyne

Posted 2015-10-02T17:20:15.947

Reputation: 123

5

Just as a note, there is a leaderboard on this post. You can see the current best scoring python answer here.

– FryAmTheEggman – 2016-05-17T14:37:03.837