Empty program: Difference between revisions

From Rosetta Code
Content added Content deleted
(Added Quackery.)
(Replaced content with "=={{header|Arturo}}== <lang rebol></lang>")
Line 1: Line 1:
=={{header|Arturo}}==
{{task|Basic language learning}}
<lang rebol></lang>
[[Category:Initialization]]
[[Category:Simple]]

;Task:
Create the simplest possible program that is still considered "correct."
<br><br>

=={{header|11l}}==
An empty text file is a correct 11l program that does nothing.

=={{header|360 Assembly}}==
Return to caller
<lang 360 Assembly> BR 14
END</lang>

=={{header|8051 Assembly}}==
Continuously loops.
<lang asm>ORG RESET
jmp $</lang>

=={{header|8086 Assembly}}==
<lang asm>end</lang>

However, if the program needs to exit with an exit code of zero:

<lang asm> segment .text
global _start

_start:
mov eax, 60
xor edi, edi
syscall
end</lang>

=={{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.
<lang ARM_Assembly>.text
.global _start

_start:
mov x0, #0
mov x8, #93
svc #0</lang>

=={{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.

<lang ABAP>
report z_empty_program.
</lang>

=={{header|Ada}}==
{{works with|GCC|4.1.2}}
<lang ada>procedure Empty is
begin
null;
end;</lang>

=={{header|Agena}}==
Actually nothing is valid code, too.
<lang agena></lang>

=={{header|Aime}}==
The nil input is a valid program.
<lang aime></lang>

=={{header|ALGOL 60}}==
<lang algol60>'BEGIN' 'END'</lang>

=={{header|ALGOL 68}}==
=== Brief form ===
<lang algol68>~</lang>
=== BOLD form ===
<lang algol68>SKIP</lang>

=={{header|ALGOL W}}==
<lang algolw>.
comment using the <empty statement>;</lang>

=={{header|AmigaE}}==
<lang amigae>PROC main()
ENDPROC</lang>

=={{header|AppleScript}}==
An empty .scpt file is considered the smallest runnable code, but the following would also be acceptable.
<lang applescript>return</lang>

=={{header|Argile}}==
The empty string or file are valid and do nothing.
<lang Argile></lang>

=={{header|ARM Assembly}}==
GNU/Linux RaspberryPi example.
<lang ARM_Assembly>.text
.global _start
_start:
mov r0, #0
mov r7, #1
svc #0 </lang>

=={{header|ArnoldC}}==
<lang ArnoldC>IT'S SHOWTIME
YOU HAVE BEEN TERMINATED</lang>

=={{header|AutoHotkey}}==
An empty script would be enough. Adding "#Persistent" makes it persistent.
<lang AutoHotkey>#Persistent</lang>

=={{header|AutoIt}}==
A single comment can be considered a valid program that does nothing.
<lang AutoIt>;nothing</lang>

=={{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:
<lang Avail>Module "a"
Body</lang>
This can be further shortened by removing unambiguous whitespace to:
<lang Avail>Module"a"Body</lang>
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:
<lang Avail>Module"a"Uses"Avail"Body Print:"!";</lang>
Or with more traditional spacing:
<lang Avail>Module "a"
Uses "Avail"
Body
Print:"!";</lang>
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.

=={{header|AWK}}==
The empty string (or file) is recognised as valid program that does nothing.

The program
<lang awk> 1</lang>
is the simplest useful program, equivalent to
<lang awk>// {print}</lang>
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,
or (if no arguments are given) the standard input.

=={{header|Axe}}==
Most Axe examples omit the executable name, but it is shown in this example for completeness.
<lang axe>:.PRGMNAME
:</lang>

=={{header|BASIC}}==
{{works with|QBASIC}}
{{works with|Quick BASIC}}
{{works with|FreeBASIC}}
{{works with|uBasic/4tH}}
An empty file is a correct program. It won't be near empty as an executable file, though.
<lang qbasic></lang>
{{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:
<lang basic>RUN</lang>
0 OK, 0:1

==={{header|Applesoft BASIC}}===
<lang ApplesoftBasic></lang>

=={{header|Batch File}}==
On Windows XP and older, an empty batch file is syntactically correct and does nothing.
<lang dos></lang>
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>
<lang dos>:</lang>

=={{header|BaCon}}==
In BaCon an empty program is a valid program.
<lang bacon></lang>

=={{header|BBC BASIC}}==
In BBC BASIC an empty program is syntactically correct.
<lang bbcbasic></lang>

=={{header|bc}}==
An empty file is a valid program.

=={{header|Beeswax}}==

<lang beeswax>*</lang>
(create 6 bees moving in all 6 cardinal directions)
or
<lang beeswax>\</lang>
(create 2 bees moving in “northwest” and “southeast” directions)
or
<lang beeswax>_</lang>
(create 2 bees moving left and right)
or
<lang beeswax>/</lang>
(create 2 bees moving in “northeast” and “southwest” directions)

A valid beeswax program needs at least one of these bee spawning symbols, as a program without bees is not executable. All bees that step off the honeycomb (program area) are automatically deleted, and the program ends if no bees are left.

=={{header|Befunge}}==
@

The halt command '''@''' is required because code wraps around. An empty file would be an infinite loop.

=={{header|bootBASIC}}==
<lang bootBASIC></lang>

=={{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
<lang bracmat>touch empty
bracmat 'get$empty'</lang>

In DOS, you can do
<lang dos>touch empty
bracmat get$empty</lang>

If we drop the requirement that the shortest program is stored in a file, we can do
<lang bash>bracmat ''</lang>
(Linux)
or
<lang dos>bracmat ""</lang>
(Windows)

If two quotes to demarcate an empty string are counted as bigger than a single undemarcated non-empty expression, we can do
bracmat .

The dot is a binary operator. So the input consists of three nodes: the operator and its lhs and rhs, both empty strings in this case. If three nodes is too much, consider a slightly bigger glyph, such as the hyphen, which is a prefix, not a binary operator:
bracmat -

You also can start Bracmat without arguments, in which case it will run in interactive mode. Now press the Enter key. You have just run the shortest valid Bracmat program.

=={{header|Brainf***}}==
<pre>Empty program</pre>
''Note:'' this works as all non-instruction characters are considered comments. Alternatively, a zero-byte file also works.

=={{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:
<lang mged>opendb empty.g y</lang>

=={{header|C}}==
{{works with|C89}}
<lang c>main()
{
return 0;
}</lang>

As of C99 the return type is required, but the return statement is not.
{{works with|C99}}
<lang c>int main() { }</lang>

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}}
<lang c>const main = 195;</lang>

=={{header|C sharp|C#}}==
<lang csharp>class P{static void Main(){}}</lang>

=={{header|C++}}==
{{works with|g++|4.8.1}}
<lang cpp>int main(){}</lang>

=={{header|Clean}}==
<lang clean>module Empty

Start world = world</lang>
Compile the project with ''No Console'' or ''No Return Type'' to suppress printing of the value of the world.

=={{header|Clojure}}==
An empty file is the simplest valid Clojure program.

=={{header|COBOL}}==
{{works with|OpenCOBOL|2.0}}
<lang cobol></lang>

=={{header|CoffeeScript}}==
<lang coffeescript></lang>

=={{header|Common Lisp}}==
<lang lisp>()</lang>

=={{header|Component Pascal}}==
BlackBox Component Builder;
<lang oberon2>
MODULE Main;
END Main.
</lang>

=={{header|Computer/zero Assembly}}==
The smallest legal program is a single Stop instruction.
<lang czasm> STP</lang>

=={{header|D}}==
<lang d>void main() {}</lang>

=={{header|Dart}}==
<lang dart>main() {
}</lang>

=={{header|dc}}==
An empty file is a valid program.

=={{header|DCL}}==
An empty file is a valid program.

=={{header|Delphi}}==
:''See [[#Pascal|Pascal]]''

=={{header|Dyalect}}==

Dyalect is not very happy with a completely empty source code file, however a pair of curly brackets would do:

<lang dyalect>{}</lang>

This program would evaluate and return "nil".

=={{header|Déjà Vu}}==
<lang dejavu></lang>
Shortest module that works with <code>!import</code>:
<lang dejavu>{}</lang>

=={{header|E}}==
The shortest possible program:
<pre></pre>
This is equivalent to:
<lang e>null</lang>

=={{header|eC}}==
<pre></pre>
or
<lang ec>class EmptyApp : Application
{
void Main()
{

}
}</lang>

=={{header|EchoLisp}}==
<lang scheme>
</lang>

=={{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.
<lang edsac>T64K [ set load point ]
GK [ set base address ]
ZF [ stop ]
EZPF [ begin at load point ]</lang>

=={{header|Egel}}==
The smallest program contains nothing.
<lang Egel>
</lang>

=={{header|EGL}}==
General program
<lang EGL>
package programs;

program Empty_program type BasicProgram {}
function main()
end
end
</lang>
Rich UI handler (but also without 'initialUI = [ ui ], onConstructionFunction = start' it would have been valid.)
<pre>
package ruihandlers;

import com.ibm.egl.rui.widgets.Div;

handler Empty_program type RUIhandler {initialUI = [ ui ], onConstructionFunction = start}
ui Div{};
function start()
end
end
</pre>

=={{header|Eiffel}}==
A file called root.e:
<lang eiffel>class
ROOT

create
make

feature
make
do
end
end</lang>

=={{header|Elena}}==
ELENA 4.x
<lang elena>public program()
{
}</lang>

=={{header|Elixir}}==
<lang elixir></lang>

=={{header|Elm}}==
<lang elm>
--Language prints the text in " "
import Html
main =
Html.text"empty"
</lang>

=={{header|Erlang}}==
An empty module:
<lang erlang>-module(empty).</lang>
An empty Erlang script file (escript):
<lang erlang>main(_) -> 1.</lang>

=={{header|ERRE}}==
<lang>
PROGRAM EMPTY
BEGIN
END PROGRAM
</lang>

=={{header|eSQL}}==
<lang sql>CREATE COMPUTE MODULE ESQL_Compute
CREATE FUNCTION Main() RETURNS BOOLEAN
BEGIN
RETURN TRUE;
END;
END MODULE;</lang>

=={{header|Euphoria}}==
<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.
<lang fsharp></lang>
An empty compiled program is:
<lang fsharp>[<EntryPoint>]
let main args = 0</lang>

=={{header|Factor}}==
<lang factor></lang>
If you want to deploy a stand-alone application, that doesn't suffice though. Here's another version.
<lang factor>IN: rosetta.empty
: main ( -- ) ;
MAIN: main</lang>

=={{header|Falcon}}==
<pre>></pre>
Prints an empty line.

<pre>>></pre>
Prints nothing.

=={{header|FALSE}}==
<lang false></lang>

=={{header|Fantom}}==
<lang fantom>class Main
{
public static Void main () {}
}</lang>

=={{header|FBSL}}==
An empty string is a valid FBSL script in both uncompiled and compiled form. It won't however produce any visible output on the screen. The minimum implementations for the user to see the result are presented below:

'''Console mode:'''
<div style="overflow:auto;white-space:nowrap;background-color:ivory;border:1px dashed rgb(47, 111, 171); padding:12px"><b><code>
<span style="color:gray">#APPTYPE CONSOLE</span><br>
<span style="color:blue">PAUSE</span>
</code></b></div>
'''Output:'''
<div style="overflow:auto;white-space:nowrap;background-color:black;border:1px dashed rgb(167, 215, 249); padding:12px"><b><code>
<span style="color:white">Press any key to continue...</span>
</code></b></div>
'''Graphics mode:'''
<div style="overflow:auto;white-space:nowrap;background-color:ivory;border:1px dashed rgb(47, 111, 171); padding:12px"><b><code>
<span style="color:blue">SHOW</span>(<span style="color:darkblue">ME</span>) <span style="color:green">' all FBSL scripts are #APPTYPE GUI on default</span><br><span style="color:red">BEGIN EVENTS<br>END EVENTS</span>
</code></b></div>
'''Output:''' [http://i1240.photobucket.com/albums/gg490/FbslGeek/FBSL_ME.png GUI Form]

'''Minimum empty Dynamic Assembler block:'''
<div style="overflow:auto;white-space:nowrap;background-color:ivory;border:1px dashed rgb(47, 111, 171); padding:12px"><b><code>
<span style="color:red">DYNASM</span> Foo()
:<span style="color:blue">RET</span> <span style="color:green">; mandatory</span><br>
<span style="color:red">END DYNASM</span>
</code></b></div>
'''Minimum empty Dynamic C block:'''
<div style="overflow:auto;white-space:nowrap;background-color:ivory;border:1px dashed rgb(47, 111, 171); padding:12px"><b><code>
<span style="color:red">DYNC</span> Foo()
:<span style="color:blue">void</span> <span style="color:red">main</span>(<span style="color:blue">void</span>)<br>
:{
::<span style="color:blue">return</span>; <span style="color:green">// optional</span><br>
:}
<span style="color:red">END DYNC</span>
</code></b></div>

=={{header|Fish}}==
Actually the shortest valid program is a space (not empty file!), which is an infinite loop, though. (It keeps looping around)
<lang Fish> </lang>
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:
<lang Fish>;</lang>

=={{header|Forth}}==
<lang forth></lang>
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.
<lang forth>bye</lang>

=={{header|Fortran}}==
<lang fortran> end</lang>

=={{header|FreeBASIC}}==
A completely empty program compiles and runs fine:
<lang freebasic></lang>

=={{header|friendly interactive shell}}==
Empty programs are valid, but are useless.
<lang fishshell></lang>

=={{header|Frink}}==
Empty programs are valid.
<lang frink></lang>

=={{header|FunL}}==
An empty text file is a valid FunL program that does nothing.
<lang funl></lang>

=={{header|Futhark}}==

Any Futhark program must have a <code>main</code> function. Alternatively, a Futhark library can be an empty file.

<lang Futhark>
let main = 0
</lang>

=={{header|FutureBasic}}==
Why?
<lang futurebasic>
end
</lang>

=={{header|Fōrmulæ}}==

In [http://wiki.formulae.org/Empty_program this] page you can see the solution of this task.

Fōrmulæ programs are not textual, visualization/edition of programs is done showing/manipulating structures but not text ([http://wiki.formulae.org/Editing_F%C5%8Drmul%C3%A6_expressions more info]). 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 transportation effects more than visualization and edition.

The option to show Fōrmulæ programs and their results is showing images. Unfortunately images cannot be uploaded in Rosetta Code.

=={{header|Gambas}}==
<lang gambas>
Public Sub Main()
End
</lang>

=={{header|Gecho}}==
Empty programs are valid.
<lang gecho></lang>

=={{header|Gema}}==
An empty program will copy input stream to output stream unchanged.
<lang gema></lang>

=={{header|Genyris}}==
<pre></pre>

=={{header|Global Script}}==
This program is intended for use with the [[HS Global Script]] and uses its syntax for imperative programs.
<lang Global Script>λ _. impunit 〈〉</lang>

=={{header|Go}}==
<lang go>package main
func main() { }</lang>

=={{header|Groovy}}==
<lang groovy></lang>

=={{header|Haskell}}==
'''Standard:''' [[Haskell 98]]

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:
<lang haskell>main = return ()</lang>
The simplest possible module other than Main is one which contains no definitions:
<lang haskell>module X where {}</lang>

=={{header|Haxe}}==
<lang haxe>class Program {
static function main() {
}
}</lang>
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}}==
<lang hicest>END ! looks better, but is not really needed</lang>

=={{header|HolyC}}==
An empty file is the simplest valid HolyC program and returns 0.

=={{header|HQ9+}}==
An empty file is a valid HQ9+ program that does nothing.

=={{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:
<lang html5><!DOCTYPE html><title></title></lang>

The shortest correct XHTML document is:
<lang html5><html xmlns="http://www.w3.org/1999/xhtml"><head><title /></head><body /></html></lang>

=={{header|Huginn}}==
<lang huginn>main(){}</lang>

=={{header|i}}==
<lang i>software{}</lang>

=={{header|Icon}} and {{header|Unicon}}==
<lang Icon>procedure main() # a null file will compile but generate a run-time error for missing main
end</lang>

=={{header|IDL}}==
<lang idl>end</lang>

=={{header|Inform 7}}==
<lang inform7>X is a room</lang>
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}}==
<lang intercal>PLEASE GIVE UP</lang>

=={{header|Io}}==
<pre></pre>

=={{header|J}}==
<lang j>''</lang>
It returns itself:
<lang j> '' -: ". ''
1</lang>

=={{header|Java}}==
{{works with|Java|1.5+}}
<lang java>public class EmptyApplet extends java.applet.Applet {
@Override public void init() {
}
}</lang>

<lang java>public class EmptyMainClass {
public static void main(String... args) {
}
}</lang>

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:

<lang java>method(arg0, arg1, arg2, arg3)</lang>

All of the args will be put into an array in the order they were in the call.

{{works with|Java|1.0+}}
<lang java>public class EmptyMainClass {
public static void main(String[] args) {
}
}</lang>

<lang java>public class EmptyApplet extends java.applet.Applet {
public void init() {
}
}</lang>

@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.

Actually this is not strictly correct. The smallest possible correct program in Java is an empty source file.

=={{header|JavaScript}}==
The empty file is a valid program.
<pre></pre>

=={{header|Joy}}==
<lang joy>.</lang>

=={{header|Jq}}==
The “empty” filter ignores its input and outputs nothing.

<lang jq>empty</lang>

=={{header|Julia}}==
Julia accepts an empty file as a program.
<lang Julia></lang>

{{out}}
<pre>
$ wc empty_program.jl
0 0 0 empty_program.jl
$ julia empty_program.jl
$
</pre>

=={{header|K}}==
<lang></lang>

=={{header|KonsolScript}}==
<lang KonsolScript>function main() {
}</lang>

=={{header|Kotlin}}==
<lang scala>fun main(a: Array<String>) {}</lang>

=={{header|Lambdatalk}}==
An empty string is a valid program.
<lang scheme></lang>

=={{header|Lang5}}==
<lang Lang5>exit</lang>

=={{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.
<lang Lasso>[]</lang>
<lang Lasso><?lasso ?></lang>
<lang Lasso><?= ?></lang>

=={{header|LaTeX}}==
<lang latex>\documentclass{article}
\begin{document}
\end{document}</lang>

=={{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).
<lang lc3asm> .END</lang>

=={{header|Liberty BASIC}}==
<lang lb>end</lang>

=={{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.
<lang lilypond>\version "2.6.12"</lang>

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):

<lang lilypond>\version "2.16.2"

\header {

}

\book {
\score {
\new Staff {
\new Voice {

}
}
\layout {

}
}
}</lang>

=={{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:
<lang lingo></lang>

=={{header|Lisp}}==
Most Lisp dialects, including Common Lisp, will accept no text (no forms) as a valid program.
<lang lisp></lang>

=={{header|Little Man Computer}}==
[https://peterhigginson.co.uk/LMC/ V1.3 of Peter Higginson's implementation of Little Man Computer] accepts an empty program. If it is assembled then ran in it, a single fetch cycle is performed, which adds 1 to the program counter, which was previously 0, then the address register then the instruction register, both of which were previously blank, are changed to 0. Similar behavior is seen in [https://www.101computing.net/LMC/ 101 Computing's implementation of Little Man Computer], in which all CPU registers start at 00, then the program counter changes to 1, the MAR to 0 and the MDR and CIR to 000.

'''Assembly'''
<lang Little Man Computer></lang>

'''Machine code'''
<lang Little Man Computer></lang>

=={{header|Logo}}==
<lang logo></lang>
or end a standalone script with "bye"
<lang logo>#! /usr/local/bin/logo

bye</lang>

=={{header|LSE}}==
<lang LSE></lang>

=={{header|LSE64}}==
As with [[Forth]], an empty file is the shortest program. To exit the interpreter at the end of a loaded file:
bye

=={{header|Lua}}==
<lang Lua></lang>

=={{header|M2000 Interpreter}}==
Open M2000 Environment, type Edit A and place one space or insert a new line, then exit pressing Esc and write Save Empty (press enter). Now write New (press enter). Now write Load Empty (press enter) and execute it: write A (press enter). Now you can close environment: write End (press enter).

To open file Empty.gsb, as text file (without loading to list of modules) use Edit "Empty.Gsb". To open it in notepad, we can use this command from M2000 console: win "notepad", dir$+"empty.gsb"

We can open explorer for dir$ (the m2000 user directory) using Win Dir$ (we can use paths without quotes if no space includes, so win c:\ open explorer to c:)

File saved as:
<lang M2000 Interpreter>
MODULE GLOBAL A {
}
</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:

<lang M2000 Interpreter>
MODULE GLOBAL A {Show
}
A
</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.

We can run empty.gsb now (supposed we save it as Save Empty, A), from explorer or using a command in M2000 console which opens another interpreter (and can feed it with some numbers or and strings, but this is another story):
<pre>
Use empty
</pre>
So now we see environment again, with open console and at prompt (execution done, and stay open because no End statement executed after the A, or inside module as Set End). Set used to send commands to prompt by code.

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
<lang M2000 Interpreter>
MODULE GLOBAL A {
Print "Hello World"
a$=Key$
Set End
}
A
</lang>

We can save it scrabbled text using Save "empty" @, A (not readable, but environment can revert the process using a unique key)

(m2000 is open source so key is not a mystery, but you can make your own clone, and use own key)

=={{header|M4}}==
<lang M4></lang>

=={{header|Maple}}==
<lang Maple></lang>

=={{header|Mathematica}} / {{header|Wolfram Language}}==
<lang Mathematica></lang>

=={{header|MATLAB}}==
<lang Matlab> function [varargout] = emptyprogram(varargin) </lang>

=={{header|Maxima}}==

<lang maxima>block()$</lang>

=={{header|MAXScript}}==
An empty MAXScript file returns "OK" on execution

=={{header|MelonBasic}}==
<lang MelonBasic></lang>

=={{header|Metafont}}==
<lang metafont>end</lang>

=={{header|Microsoft Small Basic}}==
<lang smallbasic></lang>
{{out}}<pre></pre>

=={{header|min}}==
{{works with|min|0.19.3}}
<lang min></lang>

=={{header|MiniScript}}==
<lang MiniScript></lang>

=={{header|MIPS Assembly}}==
This just exits the program with exit code 0 (exit_success)
<lang mips>
.text
main: li $v0, 10
syscall
</lang>

=={{header|МК-61/52}}==
<lang>С/П</lang>

=={{header|ML/I}}==
<lang ML/I></lang>

=={{header|MMIX}}==
<lang mmix> LOC #100
Main TRAP 0,Halt,0 // main (argc, argv) {}</lang>

=={{header|Modula-2}}==
<lang modula2>MODULE Main;

BEGIN
END Main.</lang>

=={{header|Modula-3}}==
<lang modula3>MODULE Main;

BEGIN
END Main.</lang>

=={{header|MUMPS}}==
The empty file is a valid program.
<pre></pre>

=={{header|N/t/roff}}==

{{works with|All implementations of TROFF}}
<lang N/t/roff></lang>

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}}
<lang N/t/roff>.mso me.tmac</lang>

=={{header|Nanoquery}}==
Empty files are valid Nanoquery programs that do nothing.
<lang Nanoquery></lang>

=={{header|Nemerle}}==
Compiles with warnings:
<lang Nemerle>null</lang>
Compiles without warnings (so, more correct):
<lang Nemerle>module Program
{
Main() : void
{
}
}</lang>

=={{header|NetRexx}}==
The following two samples both generate valid programs.

This minimal example requires that the file be named to match the class:
<lang NetRexx>class empty</lang>

This example will generate its class based on the file name:
<lang NetRexx>method main(args = String[]) static</lang>

=={{header|NewLISP}}==
<lang NewLISP>; </lang>

=={{header|Nim}}==
<pre></pre>

=={{header|Nit}}==
Although a Nit module (file) usually include a <tt>module</tt> declaration, an empty module is a valid Nit program.
<pre></pre>

=={{header|NS-HUBASIC}}==
<lang NS-HUBASIC></lang>

=={{header|Objeck}}==
<lang objeck>bundle Default {
class Empty {
function : Main(args : String[]) ~ Nil {
}
}</lang>

=={{header|Objective-C}}==
{{works with|gcc|4.0.1}}
<lang objc>int main(int argc, const char **argv) {
return 0;
}</lang>

The minimal ''empty'' Cocoa/OpenStep application, useful as life-support for many examples given at RosettaCode, is
<lang objc>#import <Cocoa/Cocoa.h>

int main( int argc, const char *argv[] )
{
@autoreleasepool {
[NSApplication sharedApplication];
}
return 0;
}</lang>

=={{header|OCaml}}==
{{works with|Ocaml|3.09}}
<lang ocaml>;;</lang>

Actually, the smallest possible correct program in OCaml is an empty source file.

=={{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|Oforth}}==

An empty file is a valid oforth file

<lang Oforth>oforth empty.of</lang>

Without file, interpreter can just evaluate bye :
<lang Oforth>oforth --P"bye"</lang>

=={{header|Ol}}==
An empty file is considered the smallest runnable code.

A single comment can be considered a valid program that does nothing.

A file with any one-digit number ("0", "1", .. "9") or one-character function like "+", "-", etc.) is smallest non empty runnable code.

<lang scheme>
0</lang>

=={{header|OOC}}==
The Compiler will accept an empty file:
<lang ooc></lang>

=={{header|OpenLisp}}==

We can run OpenLisp in shell mode with an empty program as follows.
This is for the Linux version of OpenLisp.

<lang openlisp>
#!/openlisp/uxlisp -shell
()
</lang>

=={{header|OxygenBasic}}==
The smallest possible program is a single space character:
<lang oxygenbasic>
</lang>

=={{header|Oz}}==
=== Accepted by compiler ===
The simplest 'program' that can be compiled is a file which contains a single expression.
<lang oz>unit</lang>
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.)
<lang oz>functor
define
skip
end</lang>

=={{header|PARI/GP}}==
<lang parigp></lang>

=={{header|Pascal}}==
<lang pascal>program ProgramName;

begin
end.</lang>
The first line is not necessary in modern Pascal dialects. With today's most compilers, the empty program is just:
<lang pascal>begin end.</lang>

=={{header|PepsiScript}}==
For typing:
<lang PepsiScript>#include default-libraries

#author .

class .:</lang>
For importing:

While • is valid, the example below is the smallest possible "compiled" program that can be made normally.

•dl◘.◙

=={{header|Perl}}==

The empty program is valid and does nothing but return a successful exit code:

<lang perl></lang>

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:

<lang perl>#!/usr/bin/perl</lang>

The smallest possible Perl one-liner is <code>perl -e0</code>.

=={{header|Phix}}==
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).

=={{header|PHP}}==
An empty text file is a correct PHP program that does nothing.

=={{header|PicoLisp}}==
<lang PicoLisp>(de foo ())</lang>

=={{header|Pike}}==
<lang pike>int main(){}</lang>

=={{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.
<lang pir>.sub empty_program
.end</lang>

=={{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.
<lang Pixilang> </lang>

=={{header|PL/I}}==
<lang PL/I>s: proc options (main);
end;</lang>

=={{header|PL/SQL}}==
<lang sql>BEGIN
NULL;
END;</lang>

=={{header|Plain English}}==
<lang plainenglish>To run:
Start up.
Shut down.</lang>

=={{header|plainTeX}}==
<lang tex>\bye</lang>

=={{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.
<lang pop11>;;; This is a valid Pop11 program that does absolutely nothing.</lang>
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:
<lang pop11>compile_mode :pop11 +strict;
define entry_point();
enddefine;

#_TERMIN_IF DEF POPC_COMPILING
entry_point();</lang>
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.

=={{header|PostScript}}==
An empty file is a valid PostScript program that does nothing.

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
<lang postscript>%!PS</lang>

If a particular version of the PS interpreter is needed, this would be included right there:
<lang postscript>%!PS-2.0
% ...or...
%!PS-3.0
% etc</lang>

=={{header|PowerShell}}==
An empty script block. A script block is a nameless (lamda) function.
<lang PowerShell>
&{}
</lang>

{{Out}}
<pre>

</pre>

=={{header|Processing}}==
An empty .pde sketch file.
<lang Processing></lang>
When run this will produce a 200x200 inactive default gray canvas.

=={{header|ProDOS}}==
This is an acceptable program:
<lang ProDOS>IGNORELINE</lang>
But also you could include a delimiter character recognized by the compiler/interpreter:
<lang ProDOS>;</lang>

=={{header|Programming Language}}==
For typing:
<lang Programming Language></lang>
For importing:

At best, the code can have one line, which is empty. The smallest way to achieve this is to type nothing. However, this is the smallest possible "compiled" program that can be generated via the compiler:

[

=={{header|PSQL}}==
<lang sql>EXECUTE BLOCK
AS
BEGIN
END</lang>

=={{header|PureBasic}}==
An empty file is a correct PureBasic program that does nothing.
<lang PureBasic></lang>

=={{header|Python}}==
An empty text file is a correct Python program that does nothing.

An empty file named <code>__init__.py</code> even has a structural purpose in Python of declaring that a directory is a [https://docs.python.org/3/tutorial/modules.html#packages Package].

=={{header|QUACKASM}}==
<lang quackasm>1
QUIT</lang>

=={{header|Quackery}}==

An empty string or text file is a valid Quackery program that does nothing.

<lang Quackery></lang>

{{out}}

<pre></pre>

=={{header|Quite BASIC}}==
<lang Quite BASIC></lang>

=={{header|R}}==
An empty text file is a valid empty program

=={{header|Racket}}==
The following shows an empty program in Racket's default language. Other Racket languages may impose different conditions on the empty program.
<lang racket>
#lang racket
</lang>

=={{header|Raku}}==
(formerly Perl 6)

The empty program is valid and does nothing but return a successful exit code:
<lang perl6></lang>

It is also possible to just specify that the program is written in Raku:
<lang perl6>use v6;</lang>

or even:
<lang perl6>v6;</lang>

=={{header|Raven}}==
An empty text file is an empty program.

=={{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:
<lang REBOL>REBOL []</lang>

=={{header|Retro}}==
An empty file is the smallest valid program.

<lang Retro></lang>

=={{header|REXX}}==
An empty (or blank) file is a valid REXX program.

Some REXX implementations require a special comment &nbsp; [1<sup>st</sup> word in the comment must be &nbsp; REXX &nbsp; (in upper/lower/mixed) case]
<br>to distinguish from other types of scripting languages, &nbsp; and the comment must be the 1<sup>st</sup> line as well as the &nbsp; REXX &nbsp; word.

<br>But a null program (or a program with only blanks in it) &nbsp; in those other scripting languages is also considered a valid program.
===version 1===
This program can be empty (no characters), &nbsp; or a program with (only) one or more blanks.
<lang rexx></lang>

===version 2===
REXX on MVS/TSO requires REXX to be within a REXX comment that begins on the first line:
<lang rexx>/*REXX*/</lang>

=={{header|Rhope}}==
{{works with|Rhope|alpha 1}}
Main(0,0)
|: :|

=={{header|Ring}}==
<lang ring></lang>

=={{header|Robotic}}==
<lang robotic></lang>

=={{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:
<lang ruby>#!/usr/bin/env ruby</lang>

=={{header|Run BASIC}}==
<lang runbasic>end ' actually a blank is ok</lang>

=={{header|Rust}}==
<lang rust>fn main(){}</lang>

=={{header|Scala}}==
<lang scala>object emptyProgram extends App {}</lang>

=={{header|Scheme}}==
<lang scheme></lang>

=={{header|Scilab}}==
<lang scilab></lang>

=={{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.
<lang ScratchScript>//</lang>

=={{header|Seed7}}==
<lang seed7>$ include "seed7_05.s7i";
const proc: main is noop;</lang>

=={{header|Set lang}}==
<lang Set_lang></lang>

=={{header|Sidef}}==
<lang ruby></lang>

=={{header|SimpleCode}}==
<lang SimpleCode></lang>

=={{header|Simula}}==
{{works with|SIMULA-67}}
<lang simula>BEGIN
END</lang>

=={{header|Slate}}==
<lang slate></lang>

=={{header|Smalltalk}}==
<lang smalltalk>[]</lang>

=={{header|SNOBOL4}}==
A valid program requires an '''end''' label. The shortest (virtually empty) program is then:
<lang snobol>end</lang>

=={{header|SNUSP}}==
$#
'''$''' sets the instruction pointer (going right), and '''#''' halts the program (empty stack).

=={{header|Sparkling}}==
<lang Sparkling></lang>

=={{header|SQL PL}}==
{{works with|Db2 LUW}}
With SQL only:
<lang sql pl>
SELECT 1 FROM sysibm.sysdummy1;
</lang>
Output:
<pre>
db2 -t
db2 => SELECT 1 FROM sysibm.sysdummy1;

1
------------
1

1 record(s) selected.
</pre>
{{works with|Db2 LUW}}
With SQL PL:
<lang sql pl>
--#SET TERMINATOR @

CREATE PROCEDURE myProc ()
BEGIN
END @
</lang>
Output:
<pre>
db2 -td@
db2 => CREATE PROCEDURE myProc ()
...
db2 (cont.) => END @
DB20000I The SQL command completed successfully.
</pre>
{{works with|Db2 LUW}} version 9.7 or higher.
With SQL PL:
<lang sql pl>
BEGIN
END;
</lang>
Output:
<pre>
db2 -t
db2 => BEGIN
db2 (cont.) => END;
DB20000I The SQL command completed successfully.
</pre>

=={{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:
<lang ssem>00000000000000000000000000000000 0. 0 to CI jump to store(0) + 1
00000000000000000000000000000000 1. 0 to CI jump to store(0) + 1</lang>
Since the number in address 0 is 0, this is equivalent to
<pre> goto 1;
1: goto 1;</pre>
and has the effect of putting the machine into an infinite loop.

The smallest program that will terminate is:
<lang ssem>00000000000001110000000000000000 0. Stop</lang>

=={{header|Standard ML}}==
<lang sml>;</lang>

Actually, the smallest possible correct program in Standard ML is an empty source file.

=={{header|Stata}}==
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.

<lang stata>program define nop
version 15
end</lang>

It's also possible to define an empty function in Mata.

<lang stata>function nop() {}</lang>

=={{header|Suneido}}==
<lang Suneido>function () { }</lang>

=={{header|Swift}}==
<lang Swift></lang>

=={{header|Symsyn}}==
<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".
<lang tcl></lang>

=={{header|TI-83 BASIC}}==
<lang TI-BASIC></lang>
Displays "Done". If an empty program isn't valid, there are numerous other one-byte solutions:
:

Disp

Return

Stop

=={{header|TI-83 Hex Assembly}}==
<lang TI-BASIC>PROGRAM:EMPTY
:AsmPrgmC9</lang>

=={{header|TI-89 BASIC}}==
Prgm
EndPrgm

=={{header|Tiny BASIC}}==
An empty program works just fine.
<lang Tiny BASIC></lang>

=={{header|Toka}}==
For interpreted code, nothing is required, although '''bye''' is necessary for an empty script to exit (rather than wait for the user to exit the listener). Hence:

bye

Or, for a directly runnable script:

#! /usr/bin/toka
bye

For compiled code, the simplest program is an empty quote:

[ ]

Again, to exit the listener, you will still need user input if this is not followed with '''bye'''.

=={{header|Trith}}==
<lang trith></lang>

=={{header|TUSCRIPT}}==
<lang tuscript>$$ MODE TUSCRIPT</lang>

=={{header|UNIX Shell}}==
{{works with|Bourne Shell}}
<lang bash>#!/bin/sh</lang>
{{works with|Bourne Again SHell}}
<lang bash>#!/bin/bash</lang>
{{works with|Korn SHell}}
<lang ksh>#!/bin/ksh</lang>

=={{header|Unlambda}}==
i
(See how i plays so many roles in unlambda?)

=={{header|Ursa}}==
The Cygnus/X Ursa interpreter has no problems with empty files, so the shortest program is an empty file.
<lang ursa></lang>

=={{header|Vala}}==
<lang Vala>void main() {} </lang>

=={{header|VAX Assembly}}==
<lang VAX Assembly>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</lang>

=={{header|VBA}}==
Same as Visual Basic, VB6, etc.
<lang vb>Sub Demo()
End Sub</lang>

=={{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>.)
<lang vb>'</lang>

=={{header|Verbexx}}==
An empty file is the smallest valid script, but running it does nothing.
<lang verbexx></lang>

=={{header|VHDL}}==
Compiled and simulated by Modelsim:
<lang VHDL>entity dummy is
end;

architecture empty of dummy is
begin
end;</lang>

=={{header|Vim Script}}==
An empty file is a valid program.

=={{header|Visual Basic}}==
'''Works with:''' VB6
<lang vb>Sub Main()
End Sub</lang>

=={{header|Visual Basic .NET}}==
{{works with|Visual Basic .NET|2005}}
<lang vbnet>Module General
Sub Main()
End Sub
End Module</lang>

=={{header|Wart}}==
<pre></pre>

=={{header|WDTE}}==

An empty 'file' is a valid WDTE script. That being said, WDTE has no inherent concept of scripts being in files, so a zero-length input may be a better description.

=={{header|WebAssembly}}==

{{libheader|WASI}}
<lang webassembly>(module
;;The entry point for WASI is called _start
(func $main (export "_start")
)
)
</lang>

=={{header|Wee Basic}}==
<lang Wee Basic></lang>

=={{header|Wren}}==
<lang ecmascript></lang>

=={{header|X86 Assembly}}==
{{works with|NASM|Linux}}
<lang asm>section .text
global _start
_start:
mov eax, 1
int 0x80
ret</lang>
{{works with|MASM}}
<lang asm>.386
.model flat, stdcall
option casemap:none

.code
start:
ret
end start</lang>

=={{header|XPL0}}==
An empty file compiles and builds an EXE file with a single RET instruction, but of course does nothing when executed.
<pre></pre>

=={{header|XQuery}}==
<lang xquery>.</lang>
The dot selects the current context node and returns it unchanged.

=={{header|XSLT}}==
<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></lang>

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:
<lang xslt><transform xmlns="http://www.w3.org/1999/XSL/Transform" version="1.0"/></lang>

This stylesheet echoes the text content of an XML file. The shortest stylesheet without any output would be
<lang xslt><transform xmlns="http://www.w3.org/1999/XSL/Transform" version="1.0">
<template match="/" />
</transform></lang>

=={{header|xTalk}}==
{{works with|HyperCard}}
on startup
end startup

=={{header|XUL}}==
<lang xul>
<?xml version="1.0"?>
</lang>

=={{header|Yorick}}==
An empty file is valid and does nothing.
<pre></pre>

=={{header|Z80 Assembly}}==
ret

=={{header|Zig}}==
<lang zig>pub fn main() void {}</lang>

=={{header|zkl}}==
An empty file/string is valid.
<pre></pre>
<lang zkl>c:=Compiler.Compiler.compileText("");
c() //--> Class(RootClass#)</lang>

=={{header|Zoea}}==
<lang Zoea>
program: empty
</lang>

=={{header|Zoomscript}}==
For typing:
<lang Zoomscript></lang>
For importing:

If nothing is entered into the "Import program" textbox, the code of the program that was already in the editor will remain.

¶0¶

=={{header|ZX Spectrum Basic}}==
:''See [[#BASIC|BASIC]]''

Revision as of 12:39, 19 February 2021

Arturo

<lang rebol></lang>