Shortest infinite loop producing no output

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>

• I've got to start posting programs with a negative byte count to beat all these empty files! – CJ Dennis Oct 3 '15 at 4:32
• This 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 Oct 5 '15 at 9:36
• Are programs that read and execute their own source code allowed, or does file I/O break the "must take no input" rule? – ThisSuitIsBlackNot Oct 6 '15 at 13:05
• @ThisSuitIsBlackNot Yes, file input is allowed. – user41805 Oct 6 '15 at 16:47
• Can you print "", an empty string? – OldBunny2800 Mar 7 '16 at 23:39

BitCycle, 3 bytes

>1<


Places a 1 bit on the playfield and infinitely moves it back and forth between the > < devices.

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.

• This doesn't loop. It's waiting for input. – Abigail Jun 9 at 22:18
• It comes down to "what is the definition of infinite loop?" Is not waiting for input an internal infinite loop? I agree it is semantics, which is why I wrote more. – Robert Benson Jun 12 at 20:11

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.

• The "non-competing" rule has been lifted, which means that this is a competing submission. – Esolanging Fruit Jul 9 '17 at 23:49
• @Challenger5 Oh, thanks. Are you sure? It doesn't say in the question that new languages are allowed. – Carcigenicate Jul 9 '17 at 23:53
• Marking as NC was the default for newer languages, but it was changed after a recent meta discussion – Esolanging Fruit Jul 10 '17 at 0:00
• @Challenger5 Awesome, thank you for pointing me to that page! That's certainly a welcome change – Carcigenicate Jul 10 '17 at 0:03

MOO, 30 28 26 bytes

while(!suspend(0))endwhile


The suspend(0) is necessary to avoid "task ran out of ticks'

• Do you need the spaces? – Esolanging Fruit Jul 9 '17 at 23:48
• No. I don't. Good point. – pppery Jul 9 '17 at 23:49

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.

'"""""'"""'""""""'"""'"""


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

• Explanation? Also, you haven't formatted it correctly, it should be '"""""'"""'""""""'"""'""". – Esolanging Fruit Jul 9 '17 at 23:48

Newline, 3 bytes

i[]


[i]


also works

{}


works only if loops[0]=infinity

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.

Nhohnhehr, 11 bytes

+-+
|$| +-+  Try it online! jq 1.5, 13 bytes until(null;1)  this also works but is no shorter: repeat(empty)  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  • Do you have an interpreter on which this program works? – FlipTack Nov 16 '17 at 7:36 • @FlipTack I think this should work, but I can't test it right now. – KSmarts Nov 16 '17 at 15:12 Hodor, 22 bytes hodor............(1){}  Hodor! Or, (44 bytes) hodor............(hodor. rhodor!? hodor? ){}  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! Operation Flashpointscripting 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. Implicit, 1 byte (  Creates a jump point. When the interpreter hits EOF and there is an open jump point, it loops forever. 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  Whispers, 16 bytes > 1 >> While 1 1  Try it online! Pyt, 3 bytes 1ł  Explanation: 1 Pushes 1 onto the stack ł Loops while the top of the stack is not zero  Try it online! 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. Forked, 0 bytes Same as the top two answers. Try it online! 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)  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. 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.

Stax, 1 byte

W


Try it online!

Just an unconditional loop without body.

axo, 1 byte

_


Try it online!

_  goes to the command at 0,0, which happens to be _

uBASIC, 7 bytes

1Goto1:


Try it online! Version that produces output may be seen Here

VBA, 7 Bytes

Anonymous VBE immediate window that takes no input and loops forever

Do:Loop


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.

• You might as well combine this answer with your VBA answer, given that they're identical. – caird coinheringaahing Feb 12 '18 at 20:37

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.

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.