Empty program: Difference between revisions

10,484 bytes added ,  2 months ago
m
m (→‎Nintendo 64: load delay slots don't apply to LA)
 
(31 intermediate revisions by 21 users not shown)
Line 12:
=={{header|360 Assembly}}==
Return to caller
<langsyntaxhighlight lang="360 Assemblyassembly"> BR 14
END</langsyntaxhighlight>
=={{header|6502 Assembly}}==
===Commodore 64===
<langsyntaxhighlight lang="6502asm">org $0801 ;start assembling at this address
db $0E,$08,$0A,$00,$9E,$20,$28,$32,$30,$36,$34,$29,$00,$00,$00 ;required init code
rts ;return to basic</langsyntaxhighlight>
 
===Nintendo Entertainment System===
Without an infinite loop the program counter will execute undefined behavior, depending on how "empty" bytes are padded. If we're generous and assume that empty bytes are padded with <code>NOP</code>, eventually the program counter will attempt to execute the interrupt vectors as executable code. If we assume that an "empty program" needs to not crash (even though you really can't tell the difference with nothing on screen), we need a way to "trap" the program counter.
 
<langsyntaxhighlight lang="6502asm">.org $8000 ;usually $8000 but it depends on the mapper.
RESET: ;execution starts here
JMP RESET
Line 37:
dw NMI ;FFFA-FFFB
dw RESET ;FFFC-FFFD ;this has to be defined or else the program counter will jump to an unknown location
dw IRQ ;FFFE-FFFF</langsyntaxhighlight>
 
=={{header|68000 Assembly}}==
Line 45:
After you get to the main program, you'll need to kick the watchdog every frame to prevent the BIOS from resetting the machine. This is done by writing any byte to memory address 0x00300001. Other than that, an endless loop will suffice (assuming you have a proper cartridge header and a vBlank routine that does nothing except check for bios vblank and return.)
 
<langsyntaxhighlight lang="68000devpac">forever:
MOVE.B D0,$300001
JMP forever</langsyntaxhighlight>
 
=={{header|8051 Assembly}}==
Continuously loops.
<langsyntaxhighlight lang="asm">ORG RESET
jmp $</langsyntaxhighlight>
 
=={{header|8086 Assembly}}==
===Boot Sector Program===
<langsyntaxhighlight lang="asm">main segment
start:
jmp start ;2 bytes
padding byte 508 dup (90h)
bootcode byte 55h,0AAh
main ends</langsyntaxhighlight>
 
If your assembler assembles the code above as an EXE file, you'll need to use a hex editor to strip the EXE header so that it fits exactly into 512 bytes.
Line 68:
 
===16-Bit x86 for EXE Files===
<langsyntaxhighlight lang="asm">.model small ;.exe file
.stack 1024 ;this value doesn't matter, I chose this arbitrarily
.data
Line 74:
.code
mov ax,4C00h
int 21h ;exit this program and return to MS-DOS</langsyntaxhighlight>
 
===32-Bit x86===
<syntaxhighlight lang ="asm">end</langsyntaxhighlight>
 
However, if the program needs to exit with an exit code of zero:
 
<langsyntaxhighlight lang="asm"> segment .text
global _start
 
Line 88:
xor edi, edi
syscall
end</langsyntaxhighlight>
 
=={{header|AArch64 Assembly}}==
Simulates system call exit(0). In AArch64, the system call number is passed via x8, and the syscall number for exit is 93.
<syntaxhighlight lang="arm_assembly">.text
<lang ARM_Assembly>.text
.global _start
 
Line 98:
mov x0, #0
mov x8, #93
svc #0</langsyntaxhighlight>
 
=={{header|ABAP}}==
Note that the statement "start-of-selection." is implicitly added. This event block needs to be present in executable programs, it's comparable to the main function in other programming languages.
 
<syntaxhighlight lang="abap">
<lang ABAP>
report z_empty_program.
</syntaxhighlight>
</lang>
 
=={{header|Action!}}==
<syntaxhighlight lang="action!"></syntaxhighlight>
<lang Action!></lang>
{{out}}
[https://gitlab.com/amarok8bit/action-rosetta-code/-/raw/master/images/Empty_program.png Screenshot from Atari 8-bit computer]
Line 114:
=={{header|Ada}}==
{{works with|GCC|4.1.2}}
<langsyntaxhighlight lang="ada">procedure Empty is
begin
null;
end;</langsyntaxhighlight>
 
=={{header|Agena}}==
Actually nothing is valid code, too.
<syntaxhighlight lang ="agena"></langsyntaxhighlight>
 
=={{header|Aime}}==
The nil input is a valid program.
<syntaxhighlight lang ="aime"></langsyntaxhighlight>
 
=={{header|ALGOL 60}}==
<syntaxhighlight lang ="algol60">'BEGIN' 'END'</langsyntaxhighlight>
 
=={{header|ALGOL 68}}==
=== Brief form ===
<syntaxhighlight lang ="algol68">~</langsyntaxhighlight>
=== BOLD form ===
<syntaxhighlight lang ="algol68">SKIP</langsyntaxhighlight>
 
=={{header|ALGOL W}}==
In Algol W, a blank statement is a valid statement and a program is a statement followed by a dot. Hence "." is the smallest valid program.
<syntaxhighlight lang ="algolw">.</langsyntaxhighlight>
 
=={{header|AmigaE}}==
<langsyntaxhighlight lang="amigae">PROC main()
ENDPROC</langsyntaxhighlight>
 
=={{header|AppleScript}}==
An empty .scpt file is considered the smallest runnable code, but the following would also be acceptable.
<syntaxhighlight lang ="applescript">return</langsyntaxhighlight>
 
=={{header|Argile}}==
The empty string or file are valid and do nothing.
<syntaxhighlight lang="argile"></syntaxhighlight>
<lang Argile></lang>
 
=={{header|ARM Assembly}}==
===GNU/Linux RaspberryPi===
<syntaxhighlight lang="arm_assembly">.text
<lang ARM_Assembly>.text
.global _start
_start:
mov r0, #0
mov r7, #1
svc #0 </langsyntaxhighlight>
 
===Game Boy Advance===
Line 166:
The first four bytes of the cartridge header are an unconditional branch instruction to the program's start. Simply duplicate this instruction at that address and voila:
 
<langsyntaxhighlight ARM_Assemblylang="arm_assembly">ProgramStart:
b ProgramStart ;don't do this on a real game boy, you'll drain the batteries faster than usual.</langsyntaxhighlight>
 
Hardware interrupts will not occur if you never enable them, so there is no need to store the interrupt service procedure's address in address $03FFFFFC to prevent a crash. The Game Boy Advance has no "exit" <code>SWI</code> call (the closest is the undocumented hard reset) so this is as close as you can get.
 
=={{header|ArnoldC}}==
<langsyntaxhighlight ArnoldClang="arnoldc">IT'S SHOWTIME
YOU HAVE BEEN TERMINATED</langsyntaxhighlight>
 
=={{header|Arturo}}==
Line 179:
A completely empty script is a valid Arturo program.
 
<syntaxhighlight lang ="rebol"></langsyntaxhighlight>
 
=={{header|Asymptote}}==
<syntaxhighlight lang="asymptote"></syntaxhighlight>
<lang Asymptote></lang>
 
=={{header|AutoHotkey}}==
An empty script would be enough. Adding "#Persistent" makes it persistent.
<syntaxhighlight lang AutoHotkey="autohotkey">#Persistent</langsyntaxhighlight>
 
=={{header|AutoIt}}==
A single comment can be considered a valid program that does nothing.
<syntaxhighlight lang AutoIt="autoit">;nothing</langsyntaxhighlight>
 
=={{header|Avail}}==
Avail files require a header block (that is generally omitted from the examples here). The shortest valid header would only include the module name, which can be reduced to 1 character, assuming the filename is set to match. For "a.avail", this gives the empty program:
<langsyntaxhighlight Availlang="avail">Module "a"
Body</langsyntaxhighlight>
This can be further shortened by removing unambiguous whitespace to:
<langsyntaxhighlight Availlang="avail">Module"a"Body</langsyntaxhighlight>
For all practical purposes, this header is useless in any other program. It does not import the standard library "Avail" (or any alternatives), so it has access to no methods, types, or values. Here's a short program capable of output:
<langsyntaxhighlight Availlang="avail">Module"a"Uses"Avail"Body Print:"!";</langsyntaxhighlight>
Or with more traditional spacing:
<langsyntaxhighlight Availlang="avail">Module "a"
Uses "Avail"
Body
Print:"!";</langsyntaxhighlight>
Note however that this output is only available as a ''compile-time'' side effect. A program defining a run-time entry point would include an <code>Entries</code> header section, or export its content for an entry point in another module to run.
 
Line 211:
 
The program
<syntaxhighlight lang ="awk"> 1</langsyntaxhighlight>
is the simplest useful program, equivalent to
<syntaxhighlight lang ="awk">// {print}</langsyntaxhighlight>
I.e. match every input-line, and print it. <br>
Like the UNIX command 'cat', it prints every line of the files given as arguments,
Line 220:
=={{header|Axe}}==
Most Axe examples omit the executable name, but it is shown in this example for completeness.
<langsyntaxhighlight lang="axe">:.PRGMNAME
:</langsyntaxhighlight>
 
=={{header|BASIC}}==
Line 229:
{{works with|uBasic/4tH}}
An empty file is a correct program. It won't be near empty as an executable file, though.
<syntaxhighlight lang ="qbasic"></langsyntaxhighlight>
{{works with|ZX Spectrum Basic}}
On the ZX Spectrum, we can have a completely empty program with no lines. Here we attempt to run the empty program:
<syntaxhighlight lang ="basic">RUN</langsyntaxhighlight>
0 OK, 0:1
 
==={{header|Applesoft BASIC}}===
<syntaxhighlight lang="applesoftbasic"></syntaxhighlight>
<lang ApplesoftBasic></lang>
 
=={{header|Batch File}}==
On Windows XP and older, an empty batch file is syntactically correct and does nothing.
<syntaxhighlight lang ="dos"></langsyntaxhighlight>
But on Windows 7, an empty .bat file is not recognized and thus a character must exist in it. Some valid characters are <code>: @ %</code>
<syntaxhighlight lang ="dos">:</langsyntaxhighlight>
 
=={{header|BaCon}}==
In BaCon an empty program is a valid program.
<syntaxhighlight lang ="bacon"></langsyntaxhighlight>
 
=={{header|BASIC256}}==
<syntaxhighlight lang ="freebasic"></langsyntaxhighlight>
 
=={{header|BBC BASIC}}==
In BBC BASIC an empty program is syntactically correct.
<syntaxhighlight lang ="bbcbasic"></langsyntaxhighlight>
 
=={{header|bc}}==
An empty file is a valid program.
 
=={{header|Binary Lambda Calculus}}==
 
At 4 bits, or half a byte, the smallest BLC program is `cat' :
 
<pre>00 10</pre>
 
corresponding to the smallest valid lambda term, the identity function \x.x
 
=={{header|Beef}}==
<syntaxhighlight lang="csharp">using System;
class Program
{
public static void Main()
{
}
}
</syntaxhighlight>
 
=={{header|Beeswax}}==
 
<syntaxhighlight lang ="beeswax">*</langsyntaxhighlight>
(create 6 bees moving in all 6 cardinal directions)
or
<syntaxhighlight lang ="beeswax">\</langsyntaxhighlight>
(create 2 bees moving in “northwest” and “southeast” directions)
or
<syntaxhighlight lang ="beeswax">_</langsyntaxhighlight>
(create 2 bees moving left and right)
or
<syntaxhighlight lang ="beeswax">/</langsyntaxhighlight>
(create 2 bees moving in “northeast” and “southwest” directions)
 
Line 280 ⟶ 298:
 
=={{header|bootBASIC}}==
<syntaxhighlight lang="bootbasic"></syntaxhighlight>
<lang bootBASIC></lang>
 
=={{header|BQN}}==
Line 287 ⟶ 305:
Any valid literal works to make a program run. The shortest way is to use a single digit, or a predefined constant, like <code>π</code> or <code>∞</code>.
 
<syntaxhighlight lang ="bqn">∞</langsyntaxhighlight>
[https://mlochbaum.github.io/BQN/try.html#code=4oie Try It!]
=={{header|Bracmat}}==
An empty file is a valid program. However you need to load it, which requires a statement. In a Linux terminal, you could do
<langsyntaxhighlight lang="bracmat">touch empty
bracmat 'get$empty'</langsyntaxhighlight>
 
In DOS, you can do
<langsyntaxhighlight lang="dos">touch empty
bracmat get$empty</langsyntaxhighlight>
 
If we drop the requirement that the shortest program is stored in a file, we can do
<syntaxhighlight lang ="bash">bracmat ''</langsyntaxhighlight>
(Linux)
or
<langsyntaxhighlight lang="dos">bracmat ""</langsyntaxhighlight>
(Windows)
 
Line 319 ⟶ 337:
=={{header|Brlcad}}==
Pressing enter from the mged prompt, just returns another prompt, so I suppose that is the smallest possible program. However, before we can draw anything we at least need to open a database:
<syntaxhighlight lang ="mged">opendb empty.g y</langsyntaxhighlight>
 
=={{header|Bruijn}}==
The smallest program in bruijn is the identity function (\x.x) and returns its input:
 
<syntaxhighlight>main [0]</syntaxhighlight>
 
=={{header|C}}==
{{works with|C89}}
<langsyntaxhighlight lang="c">main()
{
return 0;
}</langsyntaxhighlight>
 
As of C99 the return type is required, but the return statement is not.
{{works with|C99}}
<syntaxhighlight lang ="c">int main() { }</langsyntaxhighlight>
 
This is technically undefined behavior but on 8086 compatible processors <code>195</code> corresponds to the <code>ret</code> assembly instruction.
{{works with|C on 8086 compatible processors}}
<langsyntaxhighlight lang="c">const main = 195;</langsyntaxhighlight>
 
=={{header|C sharp|C#}}==
Line 341 ⟶ 364:
=={{header|C++}}==
{{works with|g++|4.8.1}}
<syntaxhighlight lang ="cpp">int main(){}</langsyntaxhighlight>
 
=={{header|Clean}}==
<langsyntaxhighlight lang="clean">module Empty
 
Start world = world</langsyntaxhighlight>
Compile the project with ''No Console'' or ''No Return Type'' to suppress printing of the value of the world.
 
==={{header|Chipmunk Basic}}===
An empty text file is a correct Chipmunk Basic program that does nothing.
 
=={{header|Clojure}}==
Line 355 ⟶ 381:
This is the shortest program that actually produces a working executable (that does nothing).
 
<syntaxhighlight lang="text">start_up = proc ()
end start_up</langsyntaxhighlight>
 
[[Portable CLU]] will compile the empty file without complaint, but not produce an
Line 363 ⟶ 389:
=={{header|COBOL}}==
{{works with|OpenCOBOL|2.0}}
<syntaxhighlight lang ="cobol"></langsyntaxhighlight>
 
=={{header|CoffeeScript}}==
<syntaxhighlight lang ="coffeescript"></langsyntaxhighlight>
 
=={{header|Common Lisp}}==
 
<syntaxhighlight lang ="lisp">()</langsyntaxhighlight>
 
<syntaxhighlight lang ="lisp">.</langsyntaxhighlight>
 
=={{header|Component Pascal}}==
BlackBox Component Builder;
<langsyntaxhighlight lang="oberon2">
MODULE Main;
END Main.
</syntaxhighlight>
</lang>
 
=={{header|Computer/zero Assembly}}==
The smallest legal program is a single Stop instruction.
<syntaxhighlight lang ="czasm"> STP</langsyntaxhighlight>
 
=={{header|Crystal}}==
<syntaxhighlight lang ="crystal"></langsyntaxhighlight>
 
=={{header|D}}==
<syntaxhighlight lang ="d">void main() {}</langsyntaxhighlight>
 
=={{header|Dart}}==
<syntaxhighlight lang ="dart">main() {}</langsyntaxhighlight>
 
=={{header|dc}}==
Line 407 ⟶ 433:
Dyalect is not very happy with a completely empty source code file, however a pair of curly brackets would do:
 
<syntaxhighlight lang ="dyalect">{}</langsyntaxhighlight>
 
This program would evaluate and return "nil".
 
=={{header|Déjà Vu}}==
<syntaxhighlight lang ="dejavu"></langsyntaxhighlight>
Shortest module that works with <code>!import</code>:
<syntaxhighlight lang ="dejavu">{}</langsyntaxhighlight>
 
=={{header|E}}==
Line 420 ⟶ 446:
<pre></pre>
This is equivalent to:
<syntaxhighlight lang ="e">null</langsyntaxhighlight>
 
=={{header|EasyLang}}==
<syntaxhighlight>
#
</syntaxhighlight>
 
=={{header|eC}}==
<pre></pre>
or
<langsyntaxhighlight lang="ec">class EmptyApp : Application
{
void Main()
Line 431 ⟶ 462:
 
}
}</langsyntaxhighlight>
 
=={{header|EchoLisp}}==
<langsyntaxhighlight lang="scheme">
</syntaxhighlight>
</lang>
 
=={{header|Ecstasy}}==
<syntaxhighlight lang="java">
module EmptyProgram {
void run() {
}
}
</syntaxhighlight>
 
=={{header|EDSAC order code}}==
The smallest program that will load and run without error. Apart from <tt>ZF</tt>, the 'stop' order, it consists solely of directives to the loader.
<langsyntaxhighlight lang="edsac">T64K [ set load point ]
GK [ set base address ]
ZF [ stop ]
EZPF [ begin at load point ]</langsyntaxhighlight>
 
=={{header|Egel}}==
The smallest program contains nothing.
<syntaxhighlight lang="egel">
<lang Egel>
</syntaxhighlight>
</lang>
 
=={{header|EGL}}==
General program
<syntaxhighlight lang="egl">
<lang EGL>
package programs;
 
Line 458 ⟶ 497:
end
end
</syntaxhighlight>
</lang>
Rich UI handler (but also without 'initialUI = [ ui ], onConstructionFunction = start' it would have been valid.)
<pre>
Line 475 ⟶ 514:
=={{header|Eiffel}}==
A file called root.e:
<langsyntaxhighlight lang="eiffel">class
ROOT
 
Line 486 ⟶ 525:
end
end</langsyntaxhighlight>
 
=={{header|Elena}}==
ELENA 4.x
<langsyntaxhighlight lang="elena">public program()
{
}</langsyntaxhighlight>
 
=={{header|Elixir}}==
<syntaxhighlight lang ="elixir"></langsyntaxhighlight>
 
=={{header|Elm}}==
<langsyntaxhighlight lang="elm">
--Language prints the text in " "
import Html
main =
Html.text"empty"
</syntaxhighlight>
</lang>
 
=={{header|EMal}}==
The empty script is valid and does nothing.
 
=={{header|Erlang}}==
An empty module:
<syntaxhighlight lang ="erlang">-module(empty).</langsyntaxhighlight>
An empty Erlang script file (escript):
<syntaxhighlight lang ="erlang">main(_) -> 1.</langsyntaxhighlight>
 
=={{header|ERRE}}==
<syntaxhighlight lang="text">
PROGRAM EMPTY
BEGIN
END PROGRAM
</syntaxhighlight>
</lang>
 
=={{header|eSQL}}==
<langsyntaxhighlight lang="sql">CREATE COMPUTE MODULE ESQL_Compute
CREATE FUNCTION Main() RETURNS BOOLEAN
BEGIN
RETURN TRUE;
END;
END MODULE;</langsyntaxhighlight>
 
=={{header|Euphoria}}==
<syntaxhighlight lang="euphoria"></syntaxhighlight>
<lang Euphoria></lang>
 
=={{header|F_Sharp|F#}}==
F# has an interactive mode and a compiled mode. The interactive interpreter will accept an empty file so the shortest valid program is an empty zero-length file with the .fsx extension.
<syntaxhighlight lang ="fsharp"></langsyntaxhighlight>
An empty compiled program is:
<langsyntaxhighlight lang="fsharp">[<EntryPoint>]
let main args = 0</langsyntaxhighlight>
 
=={{header|Factor}}==
<syntaxhighlight lang ="factor"></langsyntaxhighlight>
If you want to deploy a stand-alone application, that doesn't suffice though. Here's another version.
<langsyntaxhighlight lang="factor">IN: rosetta.empty
: main ( -- ) ;
MAIN: main</langsyntaxhighlight>
 
=={{header|Falcon}}==
Line 551 ⟶ 593:
 
=={{header|FALSE}}==
<syntaxhighlight lang ="false"></langsyntaxhighlight>
 
=={{header|Fantom}}==
<langsyntaxhighlight lang="fantom">class Main
{
public static Void main () {}
}</langsyntaxhighlight>
 
=={{header|FBSL}}==
Line 594 ⟶ 636:
 
=={{header|Fermat}}==
<syntaxhighlight lang ="fermat">;</langsyntaxhighlight>
 
=={{header|Fish}}==
Actually the shortest valid program is a space (not empty file!), which is an infinite loop, though. (It keeps looping around)
<syntaxhighlight lang Fish="fish"> </langsyntaxhighlight>
An empty program is invalid; the interpreter will give an error.<br/>
The shortest program that will actually finish is a <tt>;</tt>, which will end the program immediately:
<syntaxhighlight lang Fish="fish">;</langsyntaxhighlight>
 
=={{header|Forth}}==
<syntaxhighlight lang ="forth"></langsyntaxhighlight>
For a Forth script to be used from a shell, you usually want the last command to be BYE in order to exit the interpreter when finished.
<syntaxhighlight lang ="forth">bye</langsyntaxhighlight>
 
=={{header|Fortran}}==
<syntaxhighlight lang ="fortran"> end</langsyntaxhighlight>
 
=={{header|FreeBASIC}}==
A completely empty program compiles and runs fine:
<syntaxhighlight lang ="freebasic"></langsyntaxhighlight>
 
=={{header|friendly interactive shell}}==
Empty programs are valid, but are useless.
<syntaxhighlight lang ="fishshell"></langsyntaxhighlight>
 
=={{header|Frink}}==
Empty programs are valid.
<syntaxhighlight lang ="frink"></langsyntaxhighlight>
 
=={{header|FunL}}==
An empty text file is a valid FunL program that does nothing.
<syntaxhighlight lang ="funl"></langsyntaxhighlight>
 
=={{header|Futhark}}==
Line 631 ⟶ 673:
Any Futhark program must have a <code>main</code> function. Alternatively, a Futhark library can be an empty file.
 
<syntaxhighlight lang="futhark">
<lang Futhark>
let main = 0
</syntaxhighlight>
</lang>
 
=={{header|FutureBasic}}==
<syntaxhighlight lang ="futurebasic">HandleEvents</langsyntaxhighlight>
 
=={{header|Fōrmulæ}}==
 
{{FormulaeEntry|page=https://formulae.org/?script=examples/Empty_program}}
Fōrmulæ programs are not textual, visualization/edition of programs is done showing/manipulating structures but not text. Moreover, there can be multiple visual representations of the same program. Even though it is possible to have textual representation &mdash;i.e. XML, JSON&mdash; they are intended for storage and transfer purposes more than visualization and edition.
 
'''Solution'''
Programs in Fōrmulæ are created/edited online in its [https://formulae.org website], However they run on execution servers. By default remote servers are used, but they are limited in memory and processing power, since they are intended for demonstration and casual use. A local server can be downloaded and installed, it has no limitations (it runs in your own computer). Because of that, example programs can be fully visualized and edited, but some of them will not run if they require a moderate or heavy computation/memory resources, and no local server is being used.
 
The following is the simplest expression: the Null expression. When it is run, it does not reduce to anything else, because there should not be rewriting rules for a null expression:
In '''[https://formulae.org/?example=Empty_program this]''' page you can see the program(s) related to this task and their results.
 
[[File:Fōrmulæ - Empty program 01.png]]
 
[[File:Fōrmulæ - Empty program 02.png]]
 
=={{header|Gambas}}==
<langsyntaxhighlight lang="gambas">
Public Sub Main()
End
</syntaxhighlight>
</lang>
 
=={{header|Gecho}}==
Empty programs are valid.
<syntaxhighlight lang ="gecho"></langsyntaxhighlight>
 
=={{header|Gema}}==
An empty program will copy input stream to output stream unchanged.
<syntaxhighlight lang ="gema"></langsyntaxhighlight>
 
=={{header|Genyris}}==
Line 665 ⟶ 711:
=={{header|Global Script}}==
This program is intended for use with the [[HS Global Script]] and uses its syntax for imperative programs.
<syntaxhighlight lang="global Global Scriptscript">λ _. impunit 〈〉</langsyntaxhighlight>
 
=={{header|Go}}==
<langsyntaxhighlight lang="go">package main
func main() { }</langsyntaxhighlight>
 
=={{header|Groovy}}==
<syntaxhighlight lang ="groovy"></langsyntaxhighlight>
 
==={{header|GW-BASIC}}===
An empty text file is a correct GW-BASIC program that does nothing.
 
=={{header|Hare}}==
<syntaxhighlight lang="hare">export fn main() void = void;</syntaxhighlight>
 
=={{header|Haskell}}==
Line 678 ⟶ 730:
 
The simplest possible program is a single module using the implicit module header "<tt>module Main(main) where</tt>", and defining the action <tt>main</tt> to do nothing:
<langsyntaxhighlight lang="haskell">main = return ()</langsyntaxhighlight>
The simplest possible module other than Main is one which contains no definitions:
<syntaxhighlight lang ="haskell">module X where {}</langsyntaxhighlight>
 
=={{header|Haxe}}==
<langsyntaxhighlight lang="haxe">class Program {
static function main() {
}
}</langsyntaxhighlight>
Unlike most languages Haxe doesn't have arguments in the main function because it targets different platforms (some which don't support program arguments, eg: Flash or Javascript). You need to use the specific libraries of the platform you are targeting to get those.
 
=={{header|HicEst}}==
<langsyntaxhighlight lang="hicest">END ! looks better, but is not really needed</langsyntaxhighlight>
 
=={{header|HolyC}}==
Line 700 ⟶ 752:
=={{header|HTML}}==
HTML 5, [http://www.whatwg.org/specs/web-apps/current-work/multipage/syntax.html#optional-tags section 12.1.2.4 Optional tags], allows to omit ''html'', ''head'' and ''body'' tags. The implicit ''body'' element can be empty, but the implicit ''head'' element must contain a ''title'' element, says [http://www.whatwg.org/specs/web-apps/current-work/multipage/semantics.html#the-head-element section 4.2.1 The head element]. There seems no rule against an empty title. Therefore, the shortest correct HTML document is:
<langsyntaxhighlight lang="html5"><!DOCTYPE html><title></title></langsyntaxhighlight>
 
The shortest correct XHTML document is:
<langsyntaxhighlight lang="html5"><html xmlns="http://www.w3.org/1999/xhtml"><head><title /></head><body /></html></langsyntaxhighlight>
 
=={{header|Huginn}}==
<syntaxhighlight lang ="huginn">main(){}</langsyntaxhighlight>
 
=={{header|i}}==
<syntaxhighlight lang ="i">software{}</langsyntaxhighlight>
 
=={{header|Icon}} and {{header|Unicon}}==
<langsyntaxhighlight Iconlang="icon">procedure main() # a null file will compile but generate a run-time error for missing main
end</langsyntaxhighlight>
 
=={{header|IDL}}==
<syntaxhighlight lang ="idl">end</langsyntaxhighlight>
 
=={{header|Inform 7}}==
<syntaxhighlight lang ="inform7">X is a room</langsyntaxhighlight>
Inform 7 is a language built for making interactive fiction, so a room needs to be defined for the player to start in.
 
=={{header|Intercal}}==
<syntaxhighlight lang ="intercal">PLEASE GIVE UP</langsyntaxhighlight>
 
=={{header|Io}}==
Line 729 ⟶ 781:
 
=={{header|J}}==
<syntaxhighlight lang ="j">''</langsyntaxhighlight>
It returns itself:
<langsyntaxhighlight lang="j"> '' -: ". ''
1</langsyntaxhighlight>
 
=={{header|Java}}==
{{works with|Java|1.5+}}
<langsyntaxhighlight lang="java">public class EmptyApplet extends java.applet.Applet {
@Override public void init() {
}
}</langsyntaxhighlight>
 
<langsyntaxhighlight lang="java">public class EmptyMainClass {
public static void main(String... args) {
}
}</langsyntaxhighlight>
 
The "..." basically means "as many of these as the programmer wants." Java will put multiple arguments into an array with the given name. This will work for any method where an array is an argument, but with a twist. A call can be made like this:
 
<langsyntaxhighlight lang="java">method(arg0, arg1, arg2, arg3)</langsyntaxhighlight>
 
All of the args will be put into an array in the order they were in the call.
 
{{works with|Java|1.0+}}
<langsyntaxhighlight lang="java">public class EmptyMainClass {
public static void main(String[] args) {
}
}</langsyntaxhighlight>
 
<langsyntaxhighlight lang="java">public class EmptyApplet extends java.applet.Applet {
public void init() {
}
}</langsyntaxhighlight>
 
@Override - Indicates that a method declaration is intended to override a method declaration in a superclass. If a method is annotated with this annotation type but does not override a superclass method, compilers are required to generate an error message. It's present from JDK 5.0 (1.5.0) and up.
Line 772 ⟶ 824:
 
=={{header|Joy}}==
<syntaxhighlight lang ="joy">.</langsyntaxhighlight>
A program in Joy is a sequence of zero or more factors followed by a full stop.
 
=={{header|Jq}}==
The “empty” filter ignores its input and outputs nothing.
 
<syntaxhighlight lang ="jq">empty</langsyntaxhighlight>
 
=={{header|Julia}}==
Julia accepts an empty file as a program.
<syntaxhighlight lang="julia"></syntaxhighlight>
<lang Julia></lang>
 
{{out}}
Line 792 ⟶ 845:
 
=={{header|K}}==
<syntaxhighlight lang="text"></syntaxhighlight>
<lang></lang>
 
=={{header|KonsolScript}}==
<langsyntaxhighlight KonsolScriptlang="konsolscript">function main() {
}</langsyntaxhighlight>
 
=={{header|Kotlin}}==
<syntaxhighlight lang scala="kotlin">fun main(a: Array<String>) {}</langsyntaxhighlight>
 
=={{header|Lambdatalk}}==
An empty string is a valid program.
<syntaxhighlight lang ="scheme"></langsyntaxhighlight>
 
=={{header|Lang}}==
The empty file is a valid program.
<pre></pre>
 
=={{header|Lang5}}==
<syntaxhighlight lang Lang5="lang5">exit</langsyntaxhighlight>
 
=={{header|Lasso}}==
Lasso will parse any file thrown at it. It will ignore everything except what's inside specific Lasso delimiters. Thus a valid program that did nothing, could be an empty file. Perhaps more correct would be a file that had the specific delimiters and then nothing inside them.
<syntaxhighlight lang Lasso="lasso">[]</langsyntaxhighlight>
<langsyntaxhighlight Lassolang="lasso"><?lasso ?></langsyntaxhighlight>
<langsyntaxhighlight Lassolang="lasso"><?= ?></langsyntaxhighlight>
 
=={{header|LaTeX}}==
<langsyntaxhighlight lang="latex">\documentclass{minimal}
\begin{document}
\end{document}</langsyntaxhighlight>
 
=={{header|LC3 Assembly}}==
The only thing you absolutely need is a directive telling the assembler to stop assembling code (which in this case it has not actually started doing).
<syntaxhighlight lang ="lc3asm"> .END</langsyntaxhighlight>
 
=={{header|Liberty BASIC}}==
<syntaxhighlight lang ="lb">end</langsyntaxhighlight>
 
=={{header|Lilypond}}==
According to the manual, all lilypond programs should contain a version statement expressing the minimum version number. If this is missing then a warning will be emitted.
<langsyntaxhighlight lang="lilypond">\version "2.6.12"</langsyntaxhighlight>
 
An input file should really have a basic structure as follows. The compiler automatically adds some of the structure components if they are not present in the source code. However, explicit definition should be used to prevent the compiler from creating unwanted contexts (which can cause side effects):
 
<langsyntaxhighlight lang="lilypond">\version "2.16.2"
 
\header {
Line 850 ⟶ 907:
}
}
}</langsyntaxhighlight>
 
=={{header|Lingo}}==
"Program" doesn't really apply to Lingo. A Director projector (exe/app) doesn't have to contain any scripts/code. For scripts, the shortest possible code is:
<syntaxhighlight lang ="lingo"></langsyntaxhighlight>
 
=={{header|Lisp}}==
Most Lisp dialects, including Common Lisp, will accept no text (no forms) as a valid program.
<syntaxhighlight lang ="lisp"></langsyntaxhighlight>
 
=={{header|Little Man Computer}}==
Line 864 ⟶ 921:
 
'''Assembly'''
<syntaxhighlight lang="little man computer"></syntaxhighlight>
<lang Little Man Computer></lang>
 
'''Machine code'''
<syntaxhighlight lang="little man computer"></syntaxhighlight>
<lang Little Man Computer></lang>
 
=={{header|Logo}}==
<syntaxhighlight lang ="logo"></langsyntaxhighlight>
or end a standalone script with "bye"
<langsyntaxhighlight lang="logo">#! /usr/local/bin/logo
 
bye</langsyntaxhighlight>
 
=={{header|LSE}}==
<syntaxhighlight lang="lse"></syntaxhighlight>
<lang LSE></lang>
 
=={{header|LSE64}}==
Line 884 ⟶ 941:
 
=={{header|Lua}}==
<syntaxhighlight lang="lua"></syntaxhighlight>
<lang Lua></lang>
 
=={{header|M2000 Interpreter}}==
Line 894 ⟶ 951:
 
File saved as:
<syntaxhighlight lang="m2000 interpreter">
<lang M2000 Interpreter>
MODULE GLOBAL A {
}
</syntaxhighlight>
</lang>
Because we make it in "level 0" (from console) this is a global module. A global module which loaded from console, or was a module loaded from a file at command line, when opening the environment, erased with an End, or a New, or a Start statement (reset of environment by software), or a Break by keyboard (although a dialog ask for proceed the breaking, the reset of environment) , or in some situation by using End Process from Task Manager.
 
If we wish to run it from command line (by clicking the file in explorer, and let m2000.exe open gsb files), we have to consider the first that this file not contain an execute statement, and that if we didn't use an input statement/function which need console, then console stay hide. To be sure that console open we have to use Show statement. To run A we have to include A at the last line (or append a line and write A). So we write in first line Show (press Esc to return to prompt) and save the file as Save Empty, A so we get this:
 
<syntaxhighlight lang="m2000 interpreter">
<lang M2000 Interpreter>
MODULE GLOBAL A {Show
}
A
</syntaxhighlight>
</lang>
We can open it with Edit "empty.gsb" add some statements between A and block of module, to make some globals, say a DIM a(10) which stay there until the end of current interpreter run (interpreter may run multiple times simultaneously). All globals are globals for current interpreter only.
 
Line 917 ⟶ 974:
Finally this is the code in a file (say Empty.gsb) to open, display something, waiting for a key (now a Show automatic happen) and then finish. We have to write it, in M2000 editor, and save it using Save Empty, A or in any editor and save it as empty.gsb in your desired folder.
sav
<syntaxhighlight lang="m2000 interpreter">
<lang M2000 Interpreter>
MODULE GLOBAL A {
Print "Hello World"
Line 924 ⟶ 981:
}
A
</syntaxhighlight>
</lang>
 
We can save it scrabbled text using Save "empty" @, A (not readable, but environment can revert the process using a unique key)
Line 931 ⟶ 988:
 
=={{header|M4}}==
<syntaxhighlight lang="m4"></syntaxhighlight>
<lang M4></lang>
 
=={{header|Maple}}==
<syntaxhighlight lang="maple"></syntaxhighlight>
<lang Maple></lang>
 
=={{header|Mathematica}} / {{header|Wolfram Language}}==
<syntaxhighlight lang="mathematica"></syntaxhighlight>
<lang Mathematica></lang>
 
=={{header|MATLAB}}==
<langsyntaxhighlight Matlablang="matlab"> function [varargout] = emptyprogram(varargin) </langsyntaxhighlight>
 
=={{header|Maxima}}==
 
<syntaxhighlight lang ="maxima">block()$</langsyntaxhighlight>
 
=={{header|MAXScript}}==
Line 950 ⟶ 1,007:
 
=={{header|MelonBasic}}==
<syntaxhighlight lang="melonbasic"></syntaxhighlight>
<lang MelonBasic></lang>
 
=={{header|Metafont}}==
<syntaxhighlight lang ="metafont">end</langsyntaxhighlight>
 
=={{header|Microsoft Small Basic}}==
<syntaxhighlight lang ="smallbasic"></langsyntaxhighlight>
{{out}}<pre></pre>
 
=={{header|min}}==
{{works with|min|0.19.3}}
<syntaxhighlight lang ="min"></langsyntaxhighlight>
 
=={{header|MiniScript}}==
<syntaxhighlight lang="miniscript"></syntaxhighlight>
<lang MiniScript></lang>
 
=={{header|MIPS Assembly}}==
===Linux===
This just exits the program with exit code 0 (exit_success)
<langsyntaxhighlight lang="mips">
.text
main: li $v0, 10
syscall
</syntaxhighlight>
</lang>
===Nintendo 64===
In addition to a proper cartridge header, [[wp:Cyclic_redundancy_check|CRCs]], and footer, you'll need to write a value of <tt>8</tt> to address <tt>0xBFC007FC</tt> so that the cartridge can boot correctly. (Nintendo 64 is big-endian, so the 8 is actually stored at <tt>0xBFC007FF</tt>, but every example I've seen stores the value as a <code>uint32</code> so that's what I'm going with.)
Line 979 ⟶ 1,036:
After that, just enter an infinite loop and you're done.
 
<langsyntaxhighlight lang="mips">la $t0,0xBFC007FC
li $t1,8
sw $t1,0($t0)
Line 986 ⟶ 1,043:
nop ;not actually needed by real hardware, but Project 64 doesn't like infinite loops.
b halt
nop</langsyntaxhighlight>
 
=={{header|МК-61/52}}==
<syntaxhighlight lang="text">С/П</langsyntaxhighlight>
 
=={{header|ML/I}}==
<syntaxhighlight lang ML="ml/Ii"></langsyntaxhighlight>
 
=={{header|MMIX}}==
<langsyntaxhighlight lang="mmix"> LOC #100
Main TRAP 0,Halt,0 // main (argc, argv) {}</langsyntaxhighlight>
 
=={{header|Modula-2}}==
<langsyntaxhighlight lang="modula2">MODULE Main;
 
BEGIN
END Main.</langsyntaxhighlight>
 
=={{header|Modula-3}}==
<langsyntaxhighlight lang="modula3">MODULE Main;
 
BEGIN
END Main.</langsyntaxhighlight>
 
=={{header|MUMPS}}==
The empty file is a valid program.
<pre></pre>
 
==={{header|MSX Basic}}===
<syntaxhighlight lang="basic">10 rem</syntaxhighlight>
 
=={{header|N/t/roff}}==
 
{{works with|All implementations of TROFF}}
<syntaxhighlight lang N="n/t/roff"></langsyntaxhighlight>
 
An empty input file is valid, but if the output is Postscript or PDF, most PDF viewers will suffer. However, that's the PDF viewer's fault; the typesetter is still okay with an empty file. If one wants grace for the PDF viewers, import a macro that, at the very least, defines some proper margins and pagination as in the following code:
 
{{works with|GNU TROFF|1.22.2}}
<syntaxhighlight lang N="n/t/roff">.mso me.tmac</langsyntaxhighlight>
 
=={{header|Nanoquery}}==
Empty files are valid Nanoquery programs that do nothing.
<syntaxhighlight lang="nanoquery"></syntaxhighlight>
<lang Nanoquery></lang>
 
=={{header|Nemerle}}==
Compiles with warnings:
<syntaxhighlight lang Nemerle="nemerle">null</langsyntaxhighlight>
Compiles without warnings (so, more correct):
<langsyntaxhighlight Nemerlelang="nemerle">module Program
{
Main() : void
{
}
}</langsyntaxhighlight>
 
=={{header|NetRexx}}==
Line 1,043 ⟶ 1,103:
 
This minimal example requires that the file be named to match the class:
<syntaxhighlight lang NetRexx="netrexx">class empty</langsyntaxhighlight>
 
This example will generate its class based on the file name:
<langsyntaxhighlight NetRexxlang="netrexx">method main(args = String[]) static</langsyntaxhighlight>
 
=={{header|NewLISP}}==
<syntaxhighlight lang NewLISP="newlisp">; </langsyntaxhighlight>
 
=={{header|Nim}}==
Line 1,059 ⟶ 1,119:
 
=={{header|NS-HUBASIC}}==
<syntaxhighlight lang="ns-hubasic"></syntaxhighlight>
<lang NS-HUBASIC></lang>
 
=={{header|Oberon-2}}==
<syntaxhighlight lang="oberon2">MODULE Main;
 
BEGIN
END Main.
</syntaxhighlight>
 
=={{header|Objeck}}==
<langsyntaxhighlight lang="objeck">bundle Default {
class Empty {
function : Main(args : String[]) ~ Nil {
}
}</langsyntaxhighlight>
 
=={{header|Objective-C}}==
{{works with|gcc|4.0.1}}
<langsyntaxhighlight lang="objc">int main(int argc, const char **argv) {
return 0;
}</langsyntaxhighlight>
 
The minimal ''empty'' Cocoa/OpenStep application, useful as life-support for many examples given at RosettaCode, is
<langsyntaxhighlight lang="objc">#import <Cocoa/Cocoa.h>
 
int main( int argc, const char *argv[] )
Line 1,083 ⟶ 1,150:
}
return 0;
}</langsyntaxhighlight>
 
=={{header|OCaml}}==
{{works with|Ocaml|3.09}}
<syntaxhighlight lang ="ocaml">;;</langsyntaxhighlight>
 
Actually, the smallest possible correct program in OCaml is an empty source file.
Line 1,093 ⟶ 1,160:
=={{header|Octave}}==
An empty text file can be a valid empty program, but since Octave has the concept of "function file" (a file containing a single function; the file is automatically loaded when a function with the same name of the file, save for the extension, is called, and the first function present in the file is used), the name of the empty file matters. E.g. calling an empty file as <tt>isempty.m</tt> makes unusable the builtin <tt>isempty</tt> function.
=={{header|Odin}}==
<syntaxhighlight lang="odin">
package main
main :: proc() {}
</syntaxhighlight>
 
=={{header|Oforth}}==
Line 1,098 ⟶ 1,170:
An empty file is a valid oforth file
 
<langsyntaxhighlight Oforthlang="oforth">oforth empty.of</langsyntaxhighlight>
 
Without file, interpreter can just evaluate bye :
<langsyntaxhighlight Oforthlang="oforth">oforth --P"bye"</langsyntaxhighlight>
 
=={{header|Ol}}==
Line 1,110 ⟶ 1,182:
A file with any one-digit number ("0", "1", .. "9") or one-character function like "+", "-", etc.) is smallest non empty runnable code.
 
<langsyntaxhighlight lang="scheme">
0</langsyntaxhighlight>
 
=={{header|OOC}}==
The Compiler will accept an empty file:
<syntaxhighlight lang ="ooc"></langsyntaxhighlight>
 
=={{header|OpenLisp}}==
Line 1,122 ⟶ 1,194:
This is for the Linux version of OpenLisp.
 
<langsyntaxhighlight lang="openlisp">
#!/openlisp/uxlisp -shell
()
</syntaxhighlight>
</lang>
 
=={{header|Openscad}}==
<syntaxhighlight lang ="openscad"></langsyntaxhighlight>
 
=={{header|OxygenBasic}}==
The smallest possible program is a single space character:
<langsyntaxhighlight lang="oxygenbasic">
</syntaxhighlight>
</lang>
 
=={{header|Oz}}==
=== Accepted by compiler ===
The simplest 'program' that can be compiled is a file which contains a single expression.
<syntaxhighlight lang ="oz">unit</langsyntaxhighlight>
Such a 'program' cannot be executed, though.
=== Standalone ===
The simplest standalone program is a root functor that does not define anything. ("Functors" are first-class modules.)
<langsyntaxhighlight lang="oz">functor
define
skip
end</langsyntaxhighlight>
 
=={{header|PARI/GP}}==
<syntaxhighlight lang ="parigp"></langsyntaxhighlight>
 
=={{header|Pascal}}==
<langsyntaxhighlight lang="pascal">program ProgramName;
 
begin
end.</langsyntaxhighlight>
The first line is not necessary in modern Pascal dialects. With today's most compilers, the empty program is just:
<syntaxhighlight lang ="pascal">begin end.</langsyntaxhighlight>
 
=={{header|PepsiScript}}==
For typing:
<langsyntaxhighlight PepsiScriptlang="pepsiscript">#include default-libraries
 
#author .
 
class .:</langsyntaxhighlight>
For importing:
 
Line 1,171 ⟶ 1,243:
 
•dl◘.◙
 
=={{header|Peri}}==
 
In the Peri language, a text file with a length of zero bytes is a correct program, but it does nothing.
Similarly, a text file that consists of all whitespace characters is also a correct program that does nothing.
 
=={{header|Perl}}==
Line 1,176 ⟶ 1,253:
The empty program is valid and does nothing but return a successful exit code:
 
<syntaxhighlight lang ="perl"></langsyntaxhighlight>
 
Of course, this then requires you to specify the interpreter on the command line (i.e. <code>perl empty.pl</code>). So slightly more correct as a stand-alone program, is:
 
<syntaxhighlight lang ="perl">#!/usr/bin/perl</langsyntaxhighlight>
 
The smallest possible Perl one-liner is <code>perl -e0</code>.
Line 1,187 ⟶ 1,264:
{{libheader|Phix/basics}}
An empty file is a valid program. When compiled however, it is far from empty as it contains most of the VM and a full run-time diagnostics kit (together about 202K).
<!--<syntaxhighlight lang Phix="phix">(phixonline)--><!--</langsyntaxhighlight>-->
 
=={{header|PHP}}==
Line 1,194 ⟶ 1,271:
=={{header|Picat}}==
By default, Picat calls the <code>main/0</code> predicate:
<syntaxhighlight lang Picat="picat">main.</langsyntaxhighlight>
 
{{out}}
Line 1,202 ⟶ 1,279:
 
An shorter way is this program
<syntaxhighlight lang Picat="picat">x.</langsyntaxhighlight>
but then an explicit goal at command line (<code>-g x</code>) must be given.
 
Line 1,211 ⟶ 1,288:
 
=={{header|PicoLisp}}==
<syntaxhighlight lang PicoLisp="picolisp">(de foo ())</langsyntaxhighlight>
 
=={{header|Pike}}==
<syntaxhighlight lang ="pike">int main(){}</langsyntaxhighlight>
 
=={{header|PIR}}==
The ''':main''' pragma indicates that a subroutine is the program's entry point. However, if a subroutine is the first (or only, which would also have the effect of making it the first) routine in the program, Parrot will use that. So we may comfortably omit it in this case.
<langsyntaxhighlight lang="pir">.sub empty_program
.end</langsyntaxhighlight>
 
=={{header|Pixilang}}==
Any text longer than 0 characters is valid, otherwise resulting in a "The file is empty or does not exist" error. In this example, a space character is used.
<syntaxhighlight lang="pixilang"> </syntaxhighlight>
<lang Pixilang> </lang>
 
=={{header|PL/I}}==
<langsyntaxhighlight PLlang="pl/Ii">s: proc options (main);
end;</langsyntaxhighlight>
 
=={{header|PL/SQL}}==
<langsyntaxhighlight lang="sql">BEGIN
NULL;
END;</langsyntaxhighlight>
 
=={{header|Plain English}}==
<syntaxhighlight lang="text">To run:</syntaxhighlight>
<lang plainenglish>To run:
Start up.
Shut down.</lang>
 
=={{header|plainTeX}}==
<syntaxhighlight lang ="tex">\bye</langsyntaxhighlight>
 
=={{header|Pony}}==
<langsyntaxhighlight lang="pony">actor Main new create(e: Env) => ""</langsyntaxhighlight>
 
=={{header|Pop11}}==
Pop11 has two compilers, incremental and batch compiler. For the incremental compiler one can use just empty program text (empty file), or a file containing nothing but a comment, e.g.
<langsyntaxhighlight lang="pop11">;;; This is a valid Pop11 program that does absolutely nothing.</langsyntaxhighlight>
The batch compiler generates an executable which starts at a given entry point, so one should provide an empty function. If one wants program that works the same both with incremental compiler and batch compiler the following may be useful:
<langsyntaxhighlight lang="pop11">compile_mode :pop11 +strict;
define entry_point();
enddefine;
 
#_TERMIN_IF DEF POPC_COMPILING
entry_point();</langsyntaxhighlight>
Here the batch compiler will stop reading source before call to entry_point while incremental compiler will execute the call, ensuring that in both cases execution will start from the function entry_point.
 
Line 1,261 ⟶ 1,336:
 
Following good programming practice, however, and to ensure that a PostScript printer will interpret a file correctly, one should make the first 4 characters of the file be
<syntaxhighlight lang ="postscript">%!PS</langsyntaxhighlight>
 
If a particular version of the PS interpreter is needed, this would be included right there:
<langsyntaxhighlight lang="postscript">%!PS-2.0
% ...or...
%!PS-3.0
% etc</langsyntaxhighlight>
 
=={{header|PowerShell}}==
An empty script block. A script block is a nameless (lamda) function.
<syntaxhighlight lang="powershell">
<lang PowerShell>
&{}
</syntaxhighlight>
</lang>
 
{{Out}}
Line 1,282 ⟶ 1,357:
=={{header|Processing}}==
An empty .pde sketch file.
<syntaxhighlight lang="processing"></syntaxhighlight>
<lang Processing></lang>
When run this will produce a 200x200 inactive default gray canvas.
 
=={{header|ProDOS}}==
This is an acceptable program:
<syntaxhighlight lang ProDOS="prodos">IGNORELINE</langsyntaxhighlight>
But also you could include a delimiter character recognized by the compiler/interpreter:
<syntaxhighlight lang="prodos">;</syntaxhighlight>
<lang ProDOS>;</lang>
 
=={{header|Programming Language}}==
For typing:
<syntaxhighlight lang="programming language"></syntaxhighlight>
<lang Programming Language></lang>
For importing:
 
Line 1,301 ⟶ 1,376:
 
=={{header|PSQL}}==
<langsyntaxhighlight lang="sql">EXECUTE BLOCK
AS
BEGIN
END</langsyntaxhighlight>
 
=={{header|PureBasic}}==
An empty file is a correct PureBasic program that does nothing.
<syntaxhighlight lang="purebasic"></syntaxhighlight>
<lang PureBasic></lang>
 
=={{header|Python}}==
Line 1,316 ⟶ 1,391:
 
=={{header|QUACKASM}}==
<langsyntaxhighlight lang="quackasm">1
QUIT</langsyntaxhighlight>
 
=={{header|Quackery}}==
Line 1,323 ⟶ 1,398:
An empty string or text file is a valid Quackery program that does nothing.
 
<syntaxhighlight lang="quackery"></syntaxhighlight>
<lang Quackery></lang>
 
{{out}}
Line 1,330 ⟶ 1,405:
 
=={{header|Quite BASIC}}==
<syntaxhighlight lang="quite basic"></syntaxhighlight>
<lang Quite BASIC></lang>
 
=={{header|R}}==
Line 1,337 ⟶ 1,412:
=={{header|Racket}}==
The following shows an empty program in Racket's default language. Other Racket languages may impose different conditions on the empty program.
<langsyntaxhighlight lang="racket">
#lang racket
</syntaxhighlight>
</lang>
 
=={{header|Raku}}==
Line 1,345 ⟶ 1,420:
 
The empty program is valid and does nothing but return a successful exit code:
<syntaxhighlight lang="raku" line></syntaxhighlight>
<lang perl6></lang>
 
It is also possible to just specify that the program is written in Raku:
<syntaxhighlight lang="raku" perl6line>use v6;</langsyntaxhighlight>
 
or even:
<syntaxhighlight lang="raku" perl6line>v6;</langsyntaxhighlight>
 
=={{header|Raven}}==
Line 1,358 ⟶ 1,433:
=={{header|REBOL}}==
The header section is mandatory if you want it to be recognized as a REBOL program. It doesn't have to be filled in though:
<syntaxhighlight lang REBOL="rebol">REBOL []</langsyntaxhighlight>
 
=={{header|Retro}}==
An empty file is the smallest valid program.
 
<syntaxhighlight lang="retro"></syntaxhighlight>
<lang Retro></lang>
 
=={{header|REXX}}==
Line 1,374 ⟶ 1,449:
===version 1===
This program can be empty (no characters), &nbsp; or a program with (only) one or more blanks.
<syntaxhighlight lang ="rexx"></langsyntaxhighlight>
 
===version 2===
REXX on MVS/TSO requires REXX to be within a REXX comment that begins on the first line:
<syntaxhighlight lang ="rexx">/*REXX*/</langsyntaxhighlight>
 
=={{header|Rhope}}==
Line 1,386 ⟶ 1,461:
 
=={{header|Ring}}==
<syntaxhighlight lang ="ring"></langsyntaxhighlight>
 
=={{header|Robotic}}==
<syntaxhighlight lang ="robotic"></langsyntaxhighlight>
 
=={{header|RPL}}==
≪ ≫
 
=={{header|Ruby}}==
An empty file is a valid Ruby program. However, in order to make it runnable on *nix systems, a shebang line is necessary:
<syntaxhighlight lang ="ruby">#!/usr/bin/env ruby</langsyntaxhighlight>
 
=={{header|Run BASIC}}==
<langsyntaxhighlight lang="runbasic">end ' actually a blank is ok</langsyntaxhighlight>
 
=={{header|Rust}}==
<syntaxhighlight lang ="rust">fn main(){}</langsyntaxhighlight>
 
=={{header|Scala}}==
===Scala 2===
<lang scala>object emptyProgram extends App {}</lang>
<syntaxhighlight lang="scala">object emptyProgram extends App {}</syntaxhighlight>
===Scala 3===
<syntaxhighlight lang="scala">@main def a = ()</syntaxhighlight>
 
=={{header|Scheme}}==
<syntaxhighlight lang ="scheme"></langsyntaxhighlight>
 
=={{header|Scilab}}==
<syntaxhighlight lang ="scilab"></langsyntaxhighlight>
 
=={{header|ScratchScript}}==
An empty program is invalid because it gives an [Err: Undefined] error. This behaviour still applies when the program isn't running. Due to this error, a program containing only an empty comment is the smallest possible valid program.
<syntaxhighlight lang="scratchscript">//</syntaxhighlight>
<lang ScratchScript>//</lang>
 
=={{header|sed}}==
A totally empty program is valid, and just copies the input unmodified. The same effect can be achieved with a single ''b'' command (which might be more convenient when called from the command line).
<syntaxhighlight lang="sh">sed "" input.txt
# vs
sed b input.txt</syntaxhighlight>
 
=={{header|Seed7}}==
<langsyntaxhighlight lang="seed7">$ include "seed7_05.s7i";
const proc: main is noop;</langsyntaxhighlight>
 
=={{header|Set lang}}==
<syntaxhighlight lang="set_lang"></syntaxhighlight>
<lang Set_lang></lang>
 
=={{header|Sidef}}==
<syntaxhighlight lang ="ruby"></langsyntaxhighlight>
 
=={{header|SimpleCode}}==
<syntaxhighlight lang="simplecode"></syntaxhighlight>
<lang SimpleCode></lang>
 
=={{header|Simula}}==
{{works with|SIMULA-67}}
<langsyntaxhighlight lang="simula">BEGIN
END</langsyntaxhighlight>
 
=={{header|Slate}}==
<syntaxhighlight lang ="slate"></langsyntaxhighlight>
 
=={{header|Smalltalk}}==
<syntaxhighlight lang ="smalltalk">[]</langsyntaxhighlight>
 
=={{header|SNOBOL4}}==
A valid program requires an '''end''' label. The shortest (virtually empty) program is then:
<syntaxhighlight lang ="snobol">end</langsyntaxhighlight>
 
=={{header|SNUSP}}==
Line 1,448 ⟶ 1,535:
 
=={{header|Sparkling}}==
<syntaxhighlight lang="sparkling"></syntaxhighlight>
<lang Sparkling></lang>
 
=={{header|SQL PL}}==
{{works with|Db2 LUW}}
With SQL only:
<langsyntaxhighlight lang="sql pl">
SELECT 1 FROM sysibm.sysdummy1;
</syntaxhighlight>
</lang>
Output:
<pre>
Line 1,469 ⟶ 1,556:
{{works with|Db2 LUW}}
With SQL PL:
<langsyntaxhighlight lang="sql pl">
--#SET TERMINATOR @
 
Line 1,475 ⟶ 1,562:
BEGIN
END @
</syntaxhighlight>
</lang>
Output:
<pre>
Line 1,486 ⟶ 1,573:
{{works with|Db2 LUW}} version 9.7 or higher.
With SQL PL:
<langsyntaxhighlight lang="sql pl">
BEGIN
END;
</syntaxhighlight>
</lang>
Output:
<pre>
Line 1,500 ⟶ 1,587:
=={{header|SSEM}}==
A completely empty program—all store bits clear, just power the machine up and hit Run—is meaningful in SSEM code and even does something, although not something desirable:
<langsyntaxhighlight lang="ssem">00000000000000000000000000000000 0. 0 to CI jump to store(0) + 1
00000000000000000000000000000000 1. 0 to CI jump to store(0) + 1</langsyntaxhighlight>
Since the number in address 0 is 0, this is equivalent to
<pre> goto 1;
Line 1,508 ⟶ 1,595:
 
The smallest program that will terminate is:
<syntaxhighlight lang ="ssem">00000000000001110000000000000000 0. Stop</langsyntaxhighlight>
 
=={{header|Standard ML}}==
<syntaxhighlight lang ="sml">;</langsyntaxhighlight>
 
Actually, the smallest possible correct program in Standard ML is an empty source file.
Line 1,518 ⟶ 1,605:
Stata does not accept an empty program, so we have to do something. Here we only declare the minimum [http://www.stata.com/help.cgi?version version] of the interpreter for the program.
 
<langsyntaxhighlight lang="stata">program define nop
version 15
end</langsyntaxhighlight>
 
It's also possible to define an empty function in Mata.
 
<syntaxhighlight lang ="stata">function nop() {}</langsyntaxhighlight>
 
=={{header|Suneido}}==
<syntaxhighlight lang Suneido="suneido">function () { }</langsyntaxhighlight>
 
=={{header|Swift}}==
<syntaxhighlight lang="swift"></syntaxhighlight>
<lang Swift></lang>
 
=={{header|Symsyn}}==
<syntaxhighlight lang="symsyn"></syntaxhighlight>
<lang Symsyn></lang>
 
=={{header|Tcl}}==
Nothing is mandatory in Tcl, so an empty file named <tt>nothing.tcl</tt> would be a valid "empty program".
<syntaxhighlight lang ="tcl"></langsyntaxhighlight>
 
=={{header|TI-83 BASIC}}==
<syntaxhighlight lang="ti-basic"></syntaxhighlight>
<lang TI-BASIC></lang>
Displays "Done". If an empty program isn't valid, there are numerous other one-byte solutions:
:
Line 1,551 ⟶ 1,638:
 
=={{header|TI-83 Hex Assembly}}==
<langsyntaxhighlight TIlang="ti-BASICbasic">PROGRAM:EMPTY
:AsmPrgmC9</langsyntaxhighlight>
 
=={{header|TI-89 BASIC}}==
Line 1,560 ⟶ 1,647:
=={{header|Tiny BASIC}}==
An empty program works just fine.
<syntaxhighlight lang="tiny basic"></syntaxhighlight>
<lang Tiny BASIC></lang>
 
=={{header|Toka}}==
Line 1,579 ⟶ 1,666:
 
=={{header|Trith}}==
<syntaxhighlight lang ="trith"></langsyntaxhighlight>
 
=={{header|True BASIC}}==
<syntaxhighlight lang ="qbasic">END</langsyntaxhighlight>
 
=={{header|TUSCRIPT}}==
<syntaxhighlight lang ="tuscript">$$ MODE TUSCRIPT</langsyntaxhighlight>
 
=={{header|UNIX Shell}}==
{{works with|Bourne Shell}}
<syntaxhighlight lang ="bash">#!/bin/sh</langsyntaxhighlight>
{{works with|Bourne Again SHell}}
<syntaxhighlight lang ="bash">#!/bin/bash</langsyntaxhighlight>
{{works with|Korn SHell}}
<syntaxhighlight lang ="ksh">#!/bin/ksh</langsyntaxhighlight>
 
=={{header|Unlambda}}==
Line 1,601 ⟶ 1,688:
=={{header|Ursa}}==
The Cygnus/X Ursa interpreter has no problems with empty files, so the shortest program is an empty file.
<syntaxhighlight lang ="ursa"></langsyntaxhighlight>
 
=={{header|Vala}}==
<syntaxhighlight lang Vala="vala">void main() {} </langsyntaxhighlight>
 
=={{header|VAX Assembly}}==
<langsyntaxhighlight VAXlang="vax Assemblyassembly">0000 0000 1 .entry main,0 ;register save mask
04 0002 2 ret ;return from main procedure
0003 3 .end main ;start address for linker</langsyntaxhighlight>
 
=={{header|VBA}}==
Same as Visual Basic, VB6, etc.
<langsyntaxhighlight lang="vb">Sub Demo()
End Sub</langsyntaxhighlight>
 
=={{header|VBScript}}==
An empty .vbs file is considered the smallest runnable code, but the following (a single apostrophe as comment marker) would also be acceptable (along with other non-executing instructions like <code>option explicit</code>.)
<syntaxhighlight lang ="vb">'</langsyntaxhighlight>
 
=={{header|Verbexx}}==
An empty file is the smallest valid script, but running it does nothing.
<syntaxhighlight lang ="verbexx"></langsyntaxhighlight>
 
=={{header|Verilog}}==
<langsyntaxhighlight Veriloglang="verilog">module main;
endmodule</langsyntaxhighlight>
 
=={{header|VHDL}}==
Compiled and simulated by Modelsim:
<langsyntaxhighlight VHDLlang="vhdl">entity dummy is
end;
 
architecture empty of dummy is
begin
end;</langsyntaxhighlight>
 
=={{header|Vim Script}}==
Line 1,642 ⟶ 1,729:
=={{header|Visual Basic}}==
'''Works with:''' VB6
<langsyntaxhighlight lang="vb">Sub Main()
End Sub</langsyntaxhighlight>
 
=={{header|Visual Basic .NET}}==
{{works with|Visual Basic .NET|2005}}
<langsyntaxhighlight lang="vbnet">Module General
Sub Main()
End Sub
End Module</langsyntaxhighlight>
 
=={{header|V (Vlang)}}==
'''V (Vlang)''' can compile a 0 length, or whitespace only file as "empty", and "correct".
<pre></pre>
{{out}}
Line 1,663 ⟶ 1,750:
 
A more reasonable example, that someone might guess was a V program, and not just an emptiness:
<syntaxhighlight lang ="go">{}</langsyntaxhighlight>
 
For an even better chance at guessing that the file is meant as V source code:
 
<langsyntaxhighlight lang="go">module main
pub fn main() {}</langsyntaxhighlight>
 
=={{header|Wart}}==
Line 1,680 ⟶ 1,767:
 
{{libheader|WASI}}
<langsyntaxhighlight lang="webassembly">(module
;;The entry point for WASI is called _start
(func $main (export "_start")
Line 1,686 ⟶ 1,773:
)
)
</syntaxhighlight>
</lang>
 
=={{header|Wee Basic}}==
<syntaxhighlight lang="wee basic"></syntaxhighlight>
<lang Wee Basic></lang>
 
=={{header|Wren}}==
<syntaxhighlight lang="wren"></syntaxhighlight>
<lang ecmascript></lang>
 
=={{header|X86 Assembly}}==
{{works with|NASM|Linux}}
<langsyntaxhighlight lang="asm">section .text
global _start
Line 1,702 ⟶ 1,789:
mov eax, 1
int 0x80
ret</langsyntaxhighlight>
{{works with|MASM}}
<langsyntaxhighlight lang="asm">.386
.model flat, stdcall
option casemap:none
Line 1,711 ⟶ 1,798:
start:
ret
end start</langsyntaxhighlight>
 
=={{header|XBasic}}==
{{works with|Windows XBasic}}
{{works with|Linux XBasic}}
<syntaxhighlight lang="qbasic">PROGRAM "Empty program"
 
DECLARE FUNCTION Entry ()
 
FUNCTION Entry ()
 
END FUNCTION
END PROGRAM</syntaxhighlight>
 
=={{header|XPL0}}==
Line 1,718 ⟶ 1,817:
 
=={{header|XQuery}}==
<syntaxhighlight lang ="xquery">.</langsyntaxhighlight>
The dot selects the current context node and returns it unchanged.
 
=={{header|XSLT}}==
<langsyntaxhighlight lang="xslt"><?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<!-- code goes here -->
</xsl:stylesheet></langsyntaxhighlight>
 
Add other namespaces to the stylesheet attributes (like xmlns:fo="http://www.w3.org/1999/XSL/Format") if you use them.
 
Since XSLT is XML, and <code>transform</code> is a synonym for <code>stylesheet</code>, the example above can be minified to:
<langsyntaxhighlight lang="xslt"><transform xmlns="http://www.w3.org/1999/XSL/Transform" version="1.0"/></langsyntaxhighlight>
 
This stylesheet echoes the text content of an XML file. The shortest stylesheet without any output would be
<langsyntaxhighlight lang="xslt"><transform xmlns="http://www.w3.org/1999/XSL/Transform" version="1.0">
<template match="/" />
</transform></langsyntaxhighlight>
 
=={{header|xTalk}}==
Line 1,744 ⟶ 1,843:
 
=={{header|XUL}}==
<langsyntaxhighlight lang="xul">
<?xml version="1.0"?>
</syntaxhighlight>
</lang>
 
=={{header|Yabasic}}==
<syntaxhighlight lang ="yabasic"></langsyntaxhighlight>
 
=={{header|Yorick}}==
Line 1,759 ⟶ 1,858:
Most 8-bit computers work in a similar fashion: The BASIC interpreter acts as an operating system, and your entire program is essentially a subroutine that BASIC will <code>CALL</code>. If you "return" from your program the computer will go back to BASIC.
 
<syntaxhighlight lang ="z80">ret</langsyntaxhighlight>
 
===Game Boy===
Line 1,766 ⟶ 1,865:
The beginning of the cartridge header is a jump to the program's start.
 
<langsyntaxhighlight lang="z80">ProgramStart:
nop ;not sure if this is needed but Game Boy is somewhat buggy at times and the tutorials I used all did it
di ;disable interrupts
foo:
jp foo ;trap the program counter here. (Don't do this on a real Game Boy, you'll drain the batteries much faster than usual.)</langsyntaxhighlight>
 
=={{header|Zig}}==
<langsyntaxhighlight lang="zig">pub fn main() void {}</langsyntaxhighlight>
 
=={{header|zkl}}==
An empty file/string is valid.
<pre></pre>
<langsyntaxhighlight lang="zkl">c:=Compiler.Compiler.compileText("");
c() //--> Class(RootClass#)</langsyntaxhighlight>
 
=={{header|Zoea}}==
<syntaxhighlight lang="zoea">
<lang Zoea>
program: empty
</syntaxhighlight>
</lang>
 
=={{header|Zoea Visual}}==
Line 1,791 ⟶ 1,890:
=={{header|Zoomscript}}==
For typing:
<syntaxhighlight lang="zoomscript"></syntaxhighlight>
<lang Zoomscript></lang>
For importing:
 
56

edits