Empty program: Difference between revisions

m
m (syntax highlighting fixup automation)
 
(29 intermediate revisions by 19 users not shown)
Line 257:
=={{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}}==
Line 320 ⟶ 338:
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</syntaxhighlight>
 
=={{header|Bruijn}}==
The smallest program in bruijn is the identity function (\x.x) and returns its input:
 
<syntaxhighlight>main [0]</syntaxhighlight>
 
=={{header|C}}==
Line 348 ⟶ 371:
Start world = world</syntaxhighlight>
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 421 ⟶ 447:
This is equivalent to:
<syntaxhighlight lang="e">null</syntaxhighlight>
 
=={{header|EasyLang}}==
<syntaxhighlight>
#
</syntaxhighlight>
 
=={{header|eC}}==
Line 435 ⟶ 466:
=={{header|EchoLisp}}==
<syntaxhighlight lang="scheme">
</syntaxhighlight>
 
=={{header|Ecstasy}}==
<syntaxhighlight lang="java">
module EmptyProgram {
void run() {
}
}
</syntaxhighlight>
 
Line 504 ⟶ 543:
Html.text"empty"
</syntaxhighlight>
 
=={{header|EMal}}==
The empty script is valid and does nothing.
 
=={{header|Erlang}}==
Line 640 ⟶ 682:
=={{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}}==
Line 673 ⟶ 719:
=={{header|Groovy}}==
<syntaxhighlight lang="groovy"></syntaxhighlight>
 
==={{header|GW-BASIC}}===
An empty text file is a correct GW-BASIC program that does nothing.
 
=={{header|Hare}}==
Line 776 ⟶ 825:
=={{header|Joy}}==
<syntaxhighlight lang="joy">.</syntaxhighlight>
A program in Joy is a sequence of zero or more factors followed by a full stop.
 
=={{header|Jq}}==
Line 803 ⟶ 853:
 
=={{header|Kotlin}}==
<syntaxhighlight lang="scalakotlin">fun main(a: Array<String>) {}</syntaxhighlight>
 
=={{header|Lambdatalk}}==
An empty string is a valid program.
<syntaxhighlight lang="scheme"></syntaxhighlight>
 
=={{header|Lang}}==
The empty file is a valid program.
<pre></pre>
 
=={{header|Lang5}}==
Line 1,016 ⟶ 1,070:
The empty file is a valid program.
<pre></pre>
 
==={{header|MSX Basic}}===
<syntaxhighlight lang="basic">10 rem</syntaxhighlight>
 
=={{header|N/t/roff}}==
Line 1,063 ⟶ 1,120:
=={{header|NS-HUBASIC}}==
<syntaxhighlight lang="ns-hubasic"></syntaxhighlight>
 
=={{header|Oberon-2}}==
<syntaxhighlight lang="oberon2">MODULE Main;
 
BEGIN
END Main.
</syntaxhighlight>
 
=={{header|Objeck}}==
Line 1,096 ⟶ 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,174 ⟶ 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,238 ⟶ 1,312:
 
=={{header|Plain English}}==
<syntaxhighlight lang="plainenglishtext">To run:</syntaxhighlight>
Start up.
Shut down.</syntaxhighlight>
 
=={{header|plainTeX}}==
Line 1,393 ⟶ 1,465:
=={{header|Robotic}}==
<syntaxhighlight lang="robotic"></syntaxhighlight>
 
=={{header|RPL}}==
≪ ≫
 
=={{header|Ruby}}==
Line 1,405 ⟶ 1,480:
 
=={{header|Scala}}==
===Scala 2===
<syntaxhighlight lang="scala">object emptyProgram extends App {}</syntaxhighlight>
===Scala 3===
<syntaxhighlight lang="scala">@main def a = ()</syntaxhighlight>
 
=={{header|Scheme}}==
Line 1,416 ⟶ 1,494:
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>
 
=={{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}}==
Line 1,655 ⟶ 1,739:
End Module</syntaxhighlight>
 
=={{header|V (Vlang)}}==
'''V (Vlang)''' can compile a 0 length, or whitespace only file as "empty", and "correct".
<pre></pre>
{{out}}
Line 1,695 ⟶ 1,779:
 
=={{header|Wren}}==
<syntaxhighlight lang="ecmascriptwren"></syntaxhighlight>
 
=={{header|X86 Assembly}}==
Line 1,715 ⟶ 1,799:
ret
end start</syntaxhighlight>
 
=={{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}}==
56

edits