Empty program: Difference between revisions
Content added Content deleted
(Added Hare) |
Thundergnat (talk | contribs) m (syntax highlighting fixup automation) |
||
Line 12: | Line 12: | ||
=={{header|360 Assembly}}== |
=={{header|360 Assembly}}== |
||
Return to caller |
Return to caller |
||
< |
<syntaxhighlight lang="360 assembly"> BR 14 |
||
END</ |
END</syntaxhighlight> |
||
=={{header|6502 Assembly}}== |
=={{header|6502 Assembly}}== |
||
===Commodore 64=== |
===Commodore 64=== |
||
< |
<syntaxhighlight 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 |
db $0E,$08,$0A,$00,$9E,$20,$28,$32,$30,$36,$34,$29,$00,$00,$00 ;required init code |
||
rts ;return to basic</ |
rts ;return to basic</syntaxhighlight> |
||
===Nintendo Entertainment System=== |
===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. |
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. |
||
< |
<syntaxhighlight lang="6502asm">.org $8000 ;usually $8000 but it depends on the mapper. |
||
RESET: ;execution starts here |
RESET: ;execution starts here |
||
JMP RESET |
JMP RESET |
||
Line 37: | Line 37: | ||
dw NMI ;FFFA-FFFB |
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 RESET ;FFFC-FFFD ;this has to be defined or else the program counter will jump to an unknown location |
||
dw IRQ ;FFFE-FFFF</ |
dw IRQ ;FFFE-FFFF</syntaxhighlight> |
||
=={{header|68000 Assembly}}== |
=={{header|68000 Assembly}}== |
||
Line 45: | 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.) |
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.) |
||
< |
<syntaxhighlight lang="68000devpac">forever: |
||
MOVE.B D0,$300001 |
MOVE.B D0,$300001 |
||
JMP forever</ |
JMP forever</syntaxhighlight> |
||
=={{header|8051 Assembly}}== |
=={{header|8051 Assembly}}== |
||
Continuously loops. |
Continuously loops. |
||
< |
<syntaxhighlight lang="asm">ORG RESET |
||
jmp $</ |
jmp $</syntaxhighlight> |
||
=={{header|8086 Assembly}}== |
=={{header|8086 Assembly}}== |
||
===Boot Sector Program=== |
===Boot Sector Program=== |
||
< |
<syntaxhighlight lang="asm">main segment |
||
start: |
start: |
||
jmp start ;2 bytes |
jmp start ;2 bytes |
||
padding byte 508 dup (90h) |
padding byte 508 dup (90h) |
||
bootcode byte 55h,0AAh |
bootcode byte 55h,0AAh |
||
main ends</ |
main ends</syntaxhighlight> |
||
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. |
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: | Line 68: | ||
===16-Bit x86 for EXE Files=== |
===16-Bit x86 for EXE Files=== |
||
< |
<syntaxhighlight lang="asm">.model small ;.exe file |
||
.stack 1024 ;this value doesn't matter, I chose this arbitrarily |
.stack 1024 ;this value doesn't matter, I chose this arbitrarily |
||
.data |
.data |
||
Line 74: | Line 74: | ||
.code |
.code |
||
mov ax,4C00h |
mov ax,4C00h |
||
int 21h ;exit this program and return to MS-DOS</ |
int 21h ;exit this program and return to MS-DOS</syntaxhighlight> |
||
===32-Bit x86=== |
===32-Bit x86=== |
||
<lang |
<syntaxhighlight lang="asm">end</syntaxhighlight> |
||
However, if the program needs to exit with an exit code of zero: |
However, if the program needs to exit with an exit code of zero: |
||
< |
<syntaxhighlight lang="asm"> segment .text |
||
global _start |
global _start |
||
Line 88: | Line 88: | ||
xor edi, edi |
xor edi, edi |
||
syscall |
syscall |
||
end</ |
end</syntaxhighlight> |
||
=={{header|AArch64 Assembly}}== |
=={{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. |
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 |
.global _start |
||
Line 98: | Line 98: | ||
mov x0, #0 |
mov x0, #0 |
||
mov x8, #93 |
mov x8, #93 |
||
svc #0</ |
svc #0</syntaxhighlight> |
||
=={{header|ABAP}}== |
=={{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. |
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. |
report z_empty_program. |
||
</syntaxhighlight> |
|||
</lang> |
|||
=={{header|Action!}}== |
=={{header|Action!}}== |
||
<syntaxhighlight lang="action!"></syntaxhighlight> |
|||
<lang Action!></lang> |
|||
{{out}} |
{{out}} |
||
[https://gitlab.com/amarok8bit/action-rosetta-code/-/raw/master/images/Empty_program.png Screenshot from Atari 8-bit computer] |
[https://gitlab.com/amarok8bit/action-rosetta-code/-/raw/master/images/Empty_program.png Screenshot from Atari 8-bit computer] |
||
Line 114: | Line 114: | ||
=={{header|Ada}}== |
=={{header|Ada}}== |
||
{{works with|GCC|4.1.2}} |
{{works with|GCC|4.1.2}} |
||
< |
<syntaxhighlight lang="ada">procedure Empty is |
||
begin |
begin |
||
null; |
null; |
||
end;</ |
end;</syntaxhighlight> |
||
=={{header|Agena}}== |
=={{header|Agena}}== |
||
Actually nothing is valid code, too. |
Actually nothing is valid code, too. |
||
<lang |
<syntaxhighlight lang="agena"></syntaxhighlight> |
||
=={{header|Aime}}== |
=={{header|Aime}}== |
||
The nil input is a valid program. |
The nil input is a valid program. |
||
<lang |
<syntaxhighlight lang="aime"></syntaxhighlight> |
||
=={{header|ALGOL 60}}== |
=={{header|ALGOL 60}}== |
||
<lang |
<syntaxhighlight lang="algol60">'BEGIN' 'END'</syntaxhighlight> |
||
=={{header|ALGOL 68}}== |
=={{header|ALGOL 68}}== |
||
=== Brief form === |
=== Brief form === |
||
<lang |
<syntaxhighlight lang="algol68">~</syntaxhighlight> |
||
=== BOLD form === |
=== BOLD form === |
||
<lang |
<syntaxhighlight lang="algol68">SKIP</syntaxhighlight> |
||
=={{header|ALGOL W}}== |
=={{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. |
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. |
||
<lang |
<syntaxhighlight lang="algolw">.</syntaxhighlight> |
||
=={{header|AmigaE}}== |
=={{header|AmigaE}}== |
||
< |
<syntaxhighlight lang="amigae">PROC main() |
||
ENDPROC</ |
ENDPROC</syntaxhighlight> |
||
=={{header|AppleScript}}== |
=={{header|AppleScript}}== |
||
An empty .scpt file is considered the smallest runnable code, but the following would also be acceptable. |
An empty .scpt file is considered the smallest runnable code, but the following would also be acceptable. |
||
<lang |
<syntaxhighlight lang="applescript">return</syntaxhighlight> |
||
=={{header|Argile}}== |
=={{header|Argile}}== |
||
The empty string or file are valid and do nothing. |
The empty string or file are valid and do nothing. |
||
<syntaxhighlight lang="argile"></syntaxhighlight> |
|||
<lang Argile></lang> |
|||
=={{header|ARM Assembly}}== |
=={{header|ARM Assembly}}== |
||
===GNU/Linux RaspberryPi=== |
===GNU/Linux RaspberryPi=== |
||
<syntaxhighlight lang="arm_assembly">.text |
|||
<lang ARM_Assembly>.text |
|||
.global _start |
.global _start |
||
_start: |
_start: |
||
mov r0, #0 |
mov r0, #0 |
||
mov r7, #1 |
mov r7, #1 |
||
svc #0 </ |
svc #0 </syntaxhighlight> |
||
===Game Boy Advance=== |
===Game Boy Advance=== |
||
Line 166: | 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: |
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: |
||
< |
<syntaxhighlight lang="arm_assembly">ProgramStart: |
||
b ProgramStart ;don't do this on a real game boy, you'll drain the batteries faster than usual.</ |
b ProgramStart ;don't do this on a real game boy, you'll drain the batteries faster than usual.</syntaxhighlight> |
||
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. |
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}}== |
=={{header|ArnoldC}}== |
||
< |
<syntaxhighlight lang="arnoldc">IT'S SHOWTIME |
||
YOU HAVE BEEN TERMINATED</ |
YOU HAVE BEEN TERMINATED</syntaxhighlight> |
||
=={{header|Arturo}}== |
=={{header|Arturo}}== |
||
Line 179: | Line 179: | ||
A completely empty script is a valid Arturo program. |
A completely empty script is a valid Arturo program. |
||
<lang |
<syntaxhighlight lang="rebol"></syntaxhighlight> |
||
=={{header|Asymptote}}== |
=={{header|Asymptote}}== |
||
<syntaxhighlight lang="asymptote"></syntaxhighlight> |
|||
<lang Asymptote></lang> |
|||
=={{header|AutoHotkey}}== |
=={{header|AutoHotkey}}== |
||
An empty script would be enough. Adding "#Persistent" makes it persistent. |
An empty script would be enough. Adding "#Persistent" makes it persistent. |
||
<lang |
<syntaxhighlight lang="autohotkey">#Persistent</syntaxhighlight> |
||
=={{header|AutoIt}}== |
=={{header|AutoIt}}== |
||
A single comment can be considered a valid program that does nothing. |
A single comment can be considered a valid program that does nothing. |
||
<lang |
<syntaxhighlight lang="autoit">;nothing</syntaxhighlight> |
||
=={{header|Avail}}== |
=={{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: |
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: |
||
< |
<syntaxhighlight lang="avail">Module "a" |
||
Body</ |
Body</syntaxhighlight> |
||
This can be further shortened by removing unambiguous whitespace to: |
This can be further shortened by removing unambiguous whitespace to: |
||
< |
<syntaxhighlight lang="avail">Module"a"Body</syntaxhighlight> |
||
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: |
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: |
||
< |
<syntaxhighlight lang="avail">Module"a"Uses"Avail"Body Print:"!";</syntaxhighlight> |
||
Or with more traditional spacing: |
Or with more traditional spacing: |
||
< |
<syntaxhighlight lang="avail">Module "a" |
||
Uses "Avail" |
Uses "Avail" |
||
Body |
Body |
||
Print:"!";</ |
Print:"!";</syntaxhighlight> |
||
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. |
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: | Line 211: | ||
The program |
The program |
||
<lang |
<syntaxhighlight lang="awk"> 1</syntaxhighlight> |
||
is the simplest useful program, equivalent to |
is the simplest useful program, equivalent to |
||
<lang |
<syntaxhighlight lang="awk">// {print}</syntaxhighlight> |
||
I.e. match every input-line, and print it. <br> |
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, |
Like the UNIX command 'cat', it prints every line of the files given as arguments, |
||
Line 220: | Line 220: | ||
=={{header|Axe}}== |
=={{header|Axe}}== |
||
Most Axe examples omit the executable name, but it is shown in this example for completeness. |
Most Axe examples omit the executable name, but it is shown in this example for completeness. |
||
< |
<syntaxhighlight lang="axe">:.PRGMNAME |
||
:</ |
:</syntaxhighlight> |
||
=={{header|BASIC}}== |
=={{header|BASIC}}== |
||
Line 229: | Line 229: | ||
{{works with|uBasic/4tH}} |
{{works with|uBasic/4tH}} |
||
An empty file is a correct program. It won't be near empty as an executable file, though. |
An empty file is a correct program. It won't be near empty as an executable file, though. |
||
<lang |
<syntaxhighlight lang="qbasic"></syntaxhighlight> |
||
{{works with|ZX Spectrum Basic}} |
{{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: |
On the ZX Spectrum, we can have a completely empty program with no lines. Here we attempt to run the empty program: |
||
<lang |
<syntaxhighlight lang="basic">RUN</syntaxhighlight> |
||
0 OK, 0:1 |
0 OK, 0:1 |
||
==={{header|Applesoft BASIC}}=== |
==={{header|Applesoft BASIC}}=== |
||
<syntaxhighlight lang="applesoftbasic"></syntaxhighlight> |
|||
<lang ApplesoftBasic></lang> |
|||
=={{header|Batch File}}== |
=={{header|Batch File}}== |
||
On Windows XP and older, an empty batch file is syntactically correct and does nothing. |
On Windows XP and older, an empty batch file is syntactically correct and does nothing. |
||
<lang |
<syntaxhighlight lang="dos"></syntaxhighlight> |
||
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> |
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 |
<syntaxhighlight lang="dos">:</syntaxhighlight> |
||
=={{header|BaCon}}== |
=={{header|BaCon}}== |
||
In BaCon an empty program is a valid program. |
In BaCon an empty program is a valid program. |
||
<lang |
<syntaxhighlight lang="bacon"></syntaxhighlight> |
||
=={{header|BASIC256}}== |
=={{header|BASIC256}}== |
||
<lang |
<syntaxhighlight lang="freebasic"></syntaxhighlight> |
||
=={{header|BBC BASIC}}== |
=={{header|BBC BASIC}}== |
||
In BBC BASIC an empty program is syntactically correct. |
In BBC BASIC an empty program is syntactically correct. |
||
<lang |
<syntaxhighlight lang="bbcbasic"></syntaxhighlight> |
||
=={{header|bc}}== |
=={{header|bc}}== |
||
Line 260: | Line 260: | ||
=={{header|Beeswax}}== |
=={{header|Beeswax}}== |
||
<lang |
<syntaxhighlight lang="beeswax">*</syntaxhighlight> |
||
(create 6 bees moving in all 6 cardinal directions) |
(create 6 bees moving in all 6 cardinal directions) |
||
or |
or |
||
<lang |
<syntaxhighlight lang="beeswax">\</syntaxhighlight> |
||
(create 2 bees moving in “northwest” and “southeast” directions) |
(create 2 bees moving in “northwest” and “southeast” directions) |
||
or |
or |
||
<lang |
<syntaxhighlight lang="beeswax">_</syntaxhighlight> |
||
(create 2 bees moving left and right) |
(create 2 bees moving left and right) |
||
or |
or |
||
<lang |
<syntaxhighlight lang="beeswax">/</syntaxhighlight> |
||
(create 2 bees moving in “northeast” and “southwest” directions) |
(create 2 bees moving in “northeast” and “southwest” directions) |
||
Line 280: | Line 280: | ||
=={{header|bootBASIC}}== |
=={{header|bootBASIC}}== |
||
<syntaxhighlight lang="bootbasic"></syntaxhighlight> |
|||
<lang bootBASIC></lang> |
|||
=={{header|BQN}}== |
=={{header|BQN}}== |
||
Line 287: | Line 287: | ||
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>. |
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>. |
||
<lang |
<syntaxhighlight lang="bqn">∞</syntaxhighlight> |
||
[https://mlochbaum.github.io/BQN/try.html#code=4oie Try It!] |
[https://mlochbaum.github.io/BQN/try.html#code=4oie Try It!] |
||
=={{header|Bracmat}}== |
=={{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 |
An empty file is a valid program. However you need to load it, which requires a statement. In a Linux terminal, you could do |
||
< |
<syntaxhighlight lang="bracmat">touch empty |
||
bracmat 'get$empty'</ |
bracmat 'get$empty'</syntaxhighlight> |
||
In DOS, you can do |
In DOS, you can do |
||
< |
<syntaxhighlight lang="dos">touch empty |
||
bracmat get$empty</ |
bracmat get$empty</syntaxhighlight> |
||
If we drop the requirement that the shortest program is stored in a file, we can do |
If we drop the requirement that the shortest program is stored in a file, we can do |
||
<lang |
<syntaxhighlight lang="bash">bracmat ''</syntaxhighlight> |
||
(Linux) |
(Linux) |
||
or |
or |
||
< |
<syntaxhighlight lang="dos">bracmat ""</syntaxhighlight> |
||
(Windows) |
(Windows) |
||
Line 319: | Line 319: | ||
=={{header|Brlcad}}== |
=={{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: |
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 |
<syntaxhighlight lang="mged">opendb empty.g y</syntaxhighlight> |
||
=={{header|C}}== |
=={{header|C}}== |
||
{{works with|C89}} |
{{works with|C89}} |
||
< |
<syntaxhighlight lang="c">main() |
||
{ |
{ |
||
return 0; |
return 0; |
||
}</ |
}</syntaxhighlight> |
||
As of C99 the return type is required, but the return statement is not. |
As of C99 the return type is required, but the return statement is not. |
||
{{works with|C99}} |
{{works with|C99}} |
||
<lang |
<syntaxhighlight lang="c">int main() { }</syntaxhighlight> |
||
This is technically undefined behavior but on 8086 compatible processors <code>195</code> corresponds to the <code>ret</code> assembly instruction. |
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}} |
{{works with|C on 8086 compatible processors}} |
||
< |
<syntaxhighlight lang="c">const main = 195;</syntaxhighlight> |
||
=={{header|C sharp|C#}}== |
=={{header|C sharp|C#}}== |
||
Line 341: | Line 341: | ||
=={{header|C++}}== |
=={{header|C++}}== |
||
{{works with|g++|4.8.1}} |
{{works with|g++|4.8.1}} |
||
<lang |
<syntaxhighlight lang="cpp">int main(){}</syntaxhighlight> |
||
=={{header|Clean}}== |
=={{header|Clean}}== |
||
< |
<syntaxhighlight lang="clean">module Empty |
||
Start world = world</ |
Start world = world</syntaxhighlight> |
||
Compile the project with ''No Console'' or ''No Return Type'' to suppress printing of the value of the world. |
Compile the project with ''No Console'' or ''No Return Type'' to suppress printing of the value of the world. |
||
Line 355: | Line 355: | ||
This is the shortest program that actually produces a working executable (that does nothing). |
This is the shortest program that actually produces a working executable (that does nothing). |
||
<lang>start_up = proc () |
<syntaxhighlight lang="text">start_up = proc () |
||
end start_up</ |
end start_up</syntaxhighlight> |
||
[[Portable CLU]] will compile the empty file without complaint, but not produce an |
[[Portable CLU]] will compile the empty file without complaint, but not produce an |
||
Line 363: | Line 363: | ||
=={{header|COBOL}}== |
=={{header|COBOL}}== |
||
{{works with|OpenCOBOL|2.0}} |
{{works with|OpenCOBOL|2.0}} |
||
<lang |
<syntaxhighlight lang="cobol"></syntaxhighlight> |
||
=={{header|CoffeeScript}}== |
=={{header|CoffeeScript}}== |
||
<lang |
<syntaxhighlight lang="coffeescript"></syntaxhighlight> |
||
=={{header|Common Lisp}}== |
=={{header|Common Lisp}}== |
||
<lang |
<syntaxhighlight lang="lisp">()</syntaxhighlight> |
||
<lang |
<syntaxhighlight lang="lisp">.</syntaxhighlight> |
||
=={{header|Component Pascal}}== |
=={{header|Component Pascal}}== |
||
BlackBox Component Builder; |
BlackBox Component Builder; |
||
< |
<syntaxhighlight lang="oberon2"> |
||
MODULE Main; |
MODULE Main; |
||
END Main. |
END Main. |
||
</syntaxhighlight> |
|||
</lang> |
|||
=={{header|Computer/zero Assembly}}== |
=={{header|Computer/zero Assembly}}== |
||
The smallest legal program is a single Stop instruction. |
The smallest legal program is a single Stop instruction. |
||
<lang |
<syntaxhighlight lang="czasm"> STP</syntaxhighlight> |
||
=={{header|Crystal}}== |
=={{header|Crystal}}== |
||
<lang |
<syntaxhighlight lang="crystal"></syntaxhighlight> |
||
=={{header|D}}== |
=={{header|D}}== |
||
<lang |
<syntaxhighlight lang="d">void main() {}</syntaxhighlight> |
||
=={{header|Dart}}== |
=={{header|Dart}}== |
||
<lang |
<syntaxhighlight lang="dart">main() {}</syntaxhighlight> |
||
=={{header|dc}}== |
=={{header|dc}}== |
||
Line 407: | Line 407: | ||
Dyalect is not very happy with a completely empty source code file, however a pair of curly brackets would do: |
Dyalect is not very happy with a completely empty source code file, however a pair of curly brackets would do: |
||
<lang |
<syntaxhighlight lang="dyalect">{}</syntaxhighlight> |
||
This program would evaluate and return "nil". |
This program would evaluate and return "nil". |
||
=={{header|Déjà Vu}}== |
=={{header|Déjà Vu}}== |
||
<lang |
<syntaxhighlight lang="dejavu"></syntaxhighlight> |
||
Shortest module that works with <code>!import</code>: |
Shortest module that works with <code>!import</code>: |
||
<lang |
<syntaxhighlight lang="dejavu">{}</syntaxhighlight> |
||
=={{header|E}}== |
=={{header|E}}== |
||
Line 420: | Line 420: | ||
<pre></pre> |
<pre></pre> |
||
This is equivalent to: |
This is equivalent to: |
||
<lang |
<syntaxhighlight lang="e">null</syntaxhighlight> |
||
=={{header|eC}}== |
=={{header|eC}}== |
||
<pre></pre> |
<pre></pre> |
||
or |
or |
||
< |
<syntaxhighlight lang="ec">class EmptyApp : Application |
||
{ |
{ |
||
void Main() |
void Main() |
||
Line 431: | Line 431: | ||
} |
} |
||
}</ |
}</syntaxhighlight> |
||
=={{header|EchoLisp}}== |
=={{header|EchoLisp}}== |
||
< |
<syntaxhighlight lang="scheme"> |
||
</syntaxhighlight> |
|||
</lang> |
|||
=={{header|EDSAC order code}}== |
=={{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. |
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. |
||
< |
<syntaxhighlight lang="edsac">T64K [ set load point ] |
||
GK [ set base address ] |
GK [ set base address ] |
||
ZF [ stop ] |
ZF [ stop ] |
||
EZPF [ begin at load point ]</ |
EZPF [ begin at load point ]</syntaxhighlight> |
||
=={{header|Egel}}== |
=={{header|Egel}}== |
||
The smallest program contains nothing. |
The smallest program contains nothing. |
||
<syntaxhighlight lang="egel"> |
|||
<lang Egel> |
|||
</syntaxhighlight> |
|||
</lang> |
|||
=={{header|EGL}}== |
=={{header|EGL}}== |
||
General program |
General program |
||
<syntaxhighlight lang="egl"> |
|||
<lang EGL> |
|||
package programs; |
package programs; |
||
Line 458: | Line 458: | ||
end |
end |
||
end |
end |
||
</syntaxhighlight> |
|||
</lang> |
|||
Rich UI handler (but also without 'initialUI = [ ui ], onConstructionFunction = start' it would have been valid.) |
Rich UI handler (but also without 'initialUI = [ ui ], onConstructionFunction = start' it would have been valid.) |
||
<pre> |
<pre> |
||
Line 475: | Line 475: | ||
=={{header|Eiffel}}== |
=={{header|Eiffel}}== |
||
A file called root.e: |
A file called root.e: |
||
< |
<syntaxhighlight lang="eiffel">class |
||
ROOT |
ROOT |
||
Line 486: | Line 486: | ||
end |
end |
||
end</ |
end</syntaxhighlight> |
||
=={{header|Elena}}== |
=={{header|Elena}}== |
||
ELENA 4.x |
ELENA 4.x |
||
< |
<syntaxhighlight lang="elena">public program() |
||
{ |
{ |
||
}</ |
}</syntaxhighlight> |
||
=={{header|Elixir}}== |
=={{header|Elixir}}== |
||
<lang |
<syntaxhighlight lang="elixir"></syntaxhighlight> |
||
=={{header|Elm}}== |
=={{header|Elm}}== |
||
< |
<syntaxhighlight lang="elm"> |
||
--Language prints the text in " " |
--Language prints the text in " " |
||
import Html |
import Html |
||
main = |
main = |
||
Html.text"empty" |
Html.text"empty" |
||
</syntaxhighlight> |
|||
</lang> |
|||
=={{header|Erlang}}== |
=={{header|Erlang}}== |
||
An empty module: |
An empty module: |
||
<lang |
<syntaxhighlight lang="erlang">-module(empty).</syntaxhighlight> |
||
An empty Erlang script file (escript): |
An empty Erlang script file (escript): |
||
<lang |
<syntaxhighlight lang="erlang">main(_) -> 1.</syntaxhighlight> |
||
=={{header|ERRE}}== |
=={{header|ERRE}}== |
||
<lang> |
<syntaxhighlight lang="text"> |
||
PROGRAM EMPTY |
PROGRAM EMPTY |
||
BEGIN |
BEGIN |
||
END PROGRAM |
END PROGRAM |
||
</syntaxhighlight> |
|||
</lang> |
|||
=={{header|eSQL}}== |
=={{header|eSQL}}== |
||
< |
<syntaxhighlight lang="sql">CREATE COMPUTE MODULE ESQL_Compute |
||
CREATE FUNCTION Main() RETURNS BOOLEAN |
CREATE FUNCTION Main() RETURNS BOOLEAN |
||
BEGIN |
BEGIN |
||
RETURN TRUE; |
RETURN TRUE; |
||
END; |
END; |
||
END MODULE;</ |
END MODULE;</syntaxhighlight> |
||
=={{header|Euphoria}}== |
=={{header|Euphoria}}== |
||
<syntaxhighlight lang="euphoria"></syntaxhighlight> |
|||
<lang Euphoria></lang> |
|||
=={{header|F_Sharp|F#}}== |
=={{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. |
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 |
<syntaxhighlight lang="fsharp"></syntaxhighlight> |
||
An empty compiled program is: |
An empty compiled program is: |
||
< |
<syntaxhighlight lang="fsharp">[<EntryPoint>] |
||
let main args = 0</ |
let main args = 0</syntaxhighlight> |
||
=={{header|Factor}}== |
=={{header|Factor}}== |
||
<lang |
<syntaxhighlight lang="factor"></syntaxhighlight> |
||
If you want to deploy a stand-alone application, that doesn't suffice though. Here's another version. |
If you want to deploy a stand-alone application, that doesn't suffice though. Here's another version. |
||
< |
<syntaxhighlight lang="factor">IN: rosetta.empty |
||
: main ( -- ) ; |
: main ( -- ) ; |
||
MAIN: main</ |
MAIN: main</syntaxhighlight> |
||
=={{header|Falcon}}== |
=={{header|Falcon}}== |
||
Line 551: | Line 551: | ||
=={{header|FALSE}}== |
=={{header|FALSE}}== |
||
<lang |
<syntaxhighlight lang="false"></syntaxhighlight> |
||
=={{header|Fantom}}== |
=={{header|Fantom}}== |
||
< |
<syntaxhighlight lang="fantom">class Main |
||
{ |
{ |
||
public static Void main () {} |
public static Void main () {} |
||
}</ |
}</syntaxhighlight> |
||
=={{header|FBSL}}== |
=={{header|FBSL}}== |
||
Line 594: | Line 594: | ||
=={{header|Fermat}}== |
=={{header|Fermat}}== |
||
<lang |
<syntaxhighlight lang="fermat">;</syntaxhighlight> |
||
=={{header|Fish}}== |
=={{header|Fish}}== |
||
Actually the shortest valid program is a space (not empty file!), which is an infinite loop, though. (It keeps looping around) |
Actually the shortest valid program is a space (not empty file!), which is an infinite loop, though. (It keeps looping around) |
||
<lang |
<syntaxhighlight lang="fish"> </syntaxhighlight> |
||
An empty program is invalid; the interpreter will give an error.<br/> |
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: |
The shortest program that will actually finish is a <tt>;</tt>, which will end the program immediately: |
||
<lang |
<syntaxhighlight lang="fish">;</syntaxhighlight> |
||
=={{header|Forth}}== |
=={{header|Forth}}== |
||
<lang |
<syntaxhighlight lang="forth"></syntaxhighlight> |
||
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. |
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 |
<syntaxhighlight lang="forth">bye</syntaxhighlight> |
||
=={{header|Fortran}}== |
=={{header|Fortran}}== |
||
<lang |
<syntaxhighlight lang="fortran"> end</syntaxhighlight> |
||
=={{header|FreeBASIC}}== |
=={{header|FreeBASIC}}== |
||
A completely empty program compiles and runs fine: |
A completely empty program compiles and runs fine: |
||
<lang |
<syntaxhighlight lang="freebasic"></syntaxhighlight> |
||
=={{header|friendly interactive shell}}== |
=={{header|friendly interactive shell}}== |
||
Empty programs are valid, but are useless. |
Empty programs are valid, but are useless. |
||
<lang |
<syntaxhighlight lang="fishshell"></syntaxhighlight> |
||
=={{header|Frink}}== |
=={{header|Frink}}== |
||
Empty programs are valid. |
Empty programs are valid. |
||
<lang |
<syntaxhighlight lang="frink"></syntaxhighlight> |
||
=={{header|FunL}}== |
=={{header|FunL}}== |
||
An empty text file is a valid FunL program that does nothing. |
An empty text file is a valid FunL program that does nothing. |
||
<lang |
<syntaxhighlight lang="funl"></syntaxhighlight> |
||
=={{header|Futhark}}== |
=={{header|Futhark}}== |
||
Line 631: | Line 631: | ||
Any Futhark program must have a <code>main</code> function. Alternatively, a Futhark library can be an empty file. |
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 |
let main = 0 |
||
</syntaxhighlight> |
|||
</lang> |
|||
=={{header|FutureBasic}}== |
=={{header|FutureBasic}}== |
||
<lang |
<syntaxhighlight lang="futurebasic">HandleEvents</syntaxhighlight> |
||
=={{header|Fōrmulæ}}== |
=={{header|Fōrmulæ}}== |
||
Line 647: | Line 647: | ||
=={{header|Gambas}}== |
=={{header|Gambas}}== |
||
< |
<syntaxhighlight lang="gambas"> |
||
Public Sub Main() |
Public Sub Main() |
||
End |
End |
||
</syntaxhighlight> |
|||
</lang> |
|||
=={{header|Gecho}}== |
=={{header|Gecho}}== |
||
Empty programs are valid. |
Empty programs are valid. |
||
<lang |
<syntaxhighlight lang="gecho"></syntaxhighlight> |
||
=={{header|Gema}}== |
=={{header|Gema}}== |
||
An empty program will copy input stream to output stream unchanged. |
An empty program will copy input stream to output stream unchanged. |
||
<lang |
<syntaxhighlight lang="gema"></syntaxhighlight> |
||
=={{header|Genyris}}== |
=={{header|Genyris}}== |
||
Line 665: | Line 665: | ||
=={{header|Global Script}}== |
=={{header|Global Script}}== |
||
This program is intended for use with the [[HS Global Script]] and uses its syntax for imperative programs. |
This program is intended for use with the [[HS Global Script]] and uses its syntax for imperative programs. |
||
<lang |
<syntaxhighlight lang="global script">λ _. impunit 〈〉</syntaxhighlight> |
||
=={{header|Go}}== |
=={{header|Go}}== |
||
< |
<syntaxhighlight lang="go">package main |
||
func main() { }</ |
func main() { }</syntaxhighlight> |
||
=={{header|Groovy}}== |
=={{header|Groovy}}== |
||
<lang |
<syntaxhighlight lang="groovy"></syntaxhighlight> |
||
=={{header|Hare}}== |
=={{header|Hare}}== |
||
< |
<syntaxhighlight lang="hare">export fn main() void = void;</syntaxhighlight> |
||
=={{header|Haskell}}== |
=={{header|Haskell}}== |
||
Line 681: | Line 681: | ||
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: |
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: |
||
< |
<syntaxhighlight lang="haskell">main = return ()</syntaxhighlight> |
||
The simplest possible module other than Main is one which contains no definitions: |
The simplest possible module other than Main is one which contains no definitions: |
||
<lang |
<syntaxhighlight lang="haskell">module X where {}</syntaxhighlight> |
||
=={{header|Haxe}}== |
=={{header|Haxe}}== |
||
< |
<syntaxhighlight lang="haxe">class Program { |
||
static function main() { |
static function main() { |
||
} |
} |
||
}</ |
}</syntaxhighlight> |
||
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. |
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}}== |
=={{header|HicEst}}== |
||
< |
<syntaxhighlight lang="hicest">END ! looks better, but is not really needed</syntaxhighlight> |
||
=={{header|HolyC}}== |
=={{header|HolyC}}== |
||
Line 703: | Line 703: | ||
=={{header|HTML}}== |
=={{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: |
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: |
||
< |
<syntaxhighlight lang="html5"><!DOCTYPE html><title></title></syntaxhighlight> |
||
The shortest correct XHTML document is: |
The shortest correct XHTML document is: |
||
< |
<syntaxhighlight lang="html5"><html xmlns="http://www.w3.org/1999/xhtml"><head><title /></head><body /></html></syntaxhighlight> |
||
=={{header|Huginn}}== |
=={{header|Huginn}}== |
||
<lang |
<syntaxhighlight lang="huginn">main(){}</syntaxhighlight> |
||
=={{header|i}}== |
=={{header|i}}== |
||
<lang |
<syntaxhighlight lang="i">software{}</syntaxhighlight> |
||
=={{header|Icon}} and {{header|Unicon}}== |
=={{header|Icon}} and {{header|Unicon}}== |
||
< |
<syntaxhighlight lang="icon">procedure main() # a null file will compile but generate a run-time error for missing main |
||
end</ |
end</syntaxhighlight> |
||
=={{header|IDL}}== |
=={{header|IDL}}== |
||
<lang |
<syntaxhighlight lang="idl">end</syntaxhighlight> |
||
=={{header|Inform 7}}== |
=={{header|Inform 7}}== |
||
<lang |
<syntaxhighlight lang="inform7">X is a room</syntaxhighlight> |
||
Inform 7 is a language built for making interactive fiction, so a room needs to be defined for the player to start in. |
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}}== |
=={{header|Intercal}}== |
||
<lang |
<syntaxhighlight lang="intercal">PLEASE GIVE UP</syntaxhighlight> |
||
=={{header|Io}}== |
=={{header|Io}}== |
||
Line 732: | Line 732: | ||
=={{header|J}}== |
=={{header|J}}== |
||
<lang |
<syntaxhighlight lang="j">''</syntaxhighlight> |
||
It returns itself: |
It returns itself: |
||
< |
<syntaxhighlight lang="j"> '' -: ". '' |
||
1</ |
1</syntaxhighlight> |
||
=={{header|Java}}== |
=={{header|Java}}== |
||
{{works with|Java|1.5+}} |
{{works with|Java|1.5+}} |
||
< |
<syntaxhighlight lang="java">public class EmptyApplet extends java.applet.Applet { |
||
@Override public void init() { |
@Override public void init() { |
||
} |
} |
||
}</ |
}</syntaxhighlight> |
||
< |
<syntaxhighlight lang="java">public class EmptyMainClass { |
||
public static void main(String... args) { |
public static void main(String... args) { |
||
} |
} |
||
}</ |
}</syntaxhighlight> |
||
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: |
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: |
||
< |
<syntaxhighlight lang="java">method(arg0, arg1, arg2, arg3)</syntaxhighlight> |
||
All of the args will be put into an array in the order they were in the call. |
All of the args will be put into an array in the order they were in the call. |
||
{{works with|Java|1.0+}} |
{{works with|Java|1.0+}} |
||
< |
<syntaxhighlight lang="java">public class EmptyMainClass { |
||
public static void main(String[] args) { |
public static void main(String[] args) { |
||
} |
} |
||
}</ |
}</syntaxhighlight> |
||
< |
<syntaxhighlight lang="java">public class EmptyApplet extends java.applet.Applet { |
||
public void init() { |
public void init() { |
||
} |
} |
||
}</ |
}</syntaxhighlight> |
||
@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. |
@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 775: | Line 775: | ||
=={{header|Joy}}== |
=={{header|Joy}}== |
||
<lang |
<syntaxhighlight lang="joy">.</syntaxhighlight> |
||
=={{header|Jq}}== |
=={{header|Jq}}== |
||
The “empty” filter ignores its input and outputs nothing. |
The “empty” filter ignores its input and outputs nothing. |
||
<lang |
<syntaxhighlight lang="jq">empty</syntaxhighlight> |
||
=={{header|Julia}}== |
=={{header|Julia}}== |
||
Julia accepts an empty file as a program. |
Julia accepts an empty file as a program. |
||
<syntaxhighlight lang="julia"></syntaxhighlight> |
|||
<lang Julia></lang> |
|||
{{out}} |
{{out}} |
||
Line 795: | Line 795: | ||
=={{header|K}}== |
=={{header|K}}== |
||
<syntaxhighlight lang="text"></syntaxhighlight> |
|||
<lang></lang> |
|||
=={{header|KonsolScript}}== |
=={{header|KonsolScript}}== |
||
< |
<syntaxhighlight lang="konsolscript">function main() { |
||
}</ |
}</syntaxhighlight> |
||
=={{header|Kotlin}}== |
=={{header|Kotlin}}== |
||
< |
<syntaxhighlight lang="scala">fun main(a: Array<String>) {}</syntaxhighlight> |
||
=={{header|Lambdatalk}}== |
=={{header|Lambdatalk}}== |
||
An empty string is a valid program. |
An empty string is a valid program. |
||
<lang |
<syntaxhighlight lang="scheme"></syntaxhighlight> |
||
=={{header|Lang5}}== |
=={{header|Lang5}}== |
||
<lang |
<syntaxhighlight lang="lang5">exit</syntaxhighlight> |
||
=={{header|Lasso}}== |
=={{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. |
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 |
<syntaxhighlight lang="lasso">[]</syntaxhighlight> |
||
< |
<syntaxhighlight lang="lasso"><?lasso ?></syntaxhighlight> |
||
< |
<syntaxhighlight lang="lasso"><?= ?></syntaxhighlight> |
||
=={{header|LaTeX}}== |
=={{header|LaTeX}}== |
||
< |
<syntaxhighlight lang="latex">\documentclass{minimal} |
||
\begin{document} |
\begin{document} |
||
\end{document}</ |
\end{document}</syntaxhighlight> |
||
=={{header|LC3 Assembly}}== |
=={{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). |
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 |
<syntaxhighlight lang="lc3asm"> .END</syntaxhighlight> |
||
=={{header|Liberty BASIC}}== |
=={{header|Liberty BASIC}}== |
||
<lang |
<syntaxhighlight lang="lb">end</syntaxhighlight> |
||
=={{header|Lilypond}}== |
=={{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. |
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. |
||
< |
<syntaxhighlight lang="lilypond">\version "2.6.12"</syntaxhighlight> |
||
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): |
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): |
||
< |
<syntaxhighlight lang="lilypond">\version "2.16.2" |
||
\header { |
\header { |
||
Line 853: | Line 853: | ||
} |
} |
||
} |
} |
||
}</ |
}</syntaxhighlight> |
||
=={{header|Lingo}}== |
=={{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: |
"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 |
<syntaxhighlight lang="lingo"></syntaxhighlight> |
||
=={{header|Lisp}}== |
=={{header|Lisp}}== |
||
Most Lisp dialects, including Common Lisp, will accept no text (no forms) as a valid program. |
Most Lisp dialects, including Common Lisp, will accept no text (no forms) as a valid program. |
||
<lang |
<syntaxhighlight lang="lisp"></syntaxhighlight> |
||
=={{header|Little Man Computer}}== |
=={{header|Little Man Computer}}== |
||
Line 867: | Line 867: | ||
'''Assembly''' |
'''Assembly''' |
||
<syntaxhighlight lang="little man computer"></syntaxhighlight> |
|||
<lang Little Man Computer></lang> |
|||
'''Machine code''' |
'''Machine code''' |
||
<syntaxhighlight lang="little man computer"></syntaxhighlight> |
|||
<lang Little Man Computer></lang> |
|||
=={{header|Logo}}== |
=={{header|Logo}}== |
||
<lang |
<syntaxhighlight lang="logo"></syntaxhighlight> |
||
or end a standalone script with "bye" |
or end a standalone script with "bye" |
||
< |
<syntaxhighlight lang="logo">#! /usr/local/bin/logo |
||
bye</ |
bye</syntaxhighlight> |
||
=={{header|LSE}}== |
=={{header|LSE}}== |
||
<syntaxhighlight lang="lse"></syntaxhighlight> |
|||
<lang LSE></lang> |
|||
=={{header|LSE64}}== |
=={{header|LSE64}}== |
||
Line 887: | Line 887: | ||
=={{header|Lua}}== |
=={{header|Lua}}== |
||
<syntaxhighlight lang="lua"></syntaxhighlight> |
|||
<lang Lua></lang> |
|||
=={{header|M2000 Interpreter}}== |
=={{header|M2000 Interpreter}}== |
||
Line 897: | Line 897: | ||
File saved as: |
File saved as: |
||
<syntaxhighlight lang="m2000 interpreter"> |
|||
<lang M2000 Interpreter> |
|||
MODULE GLOBAL A { |
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. |
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: |
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 |
MODULE GLOBAL A {Show |
||
} |
} |
||
A |
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. |
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 920: | Line 920: | ||
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. |
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 |
sav |
||
<syntaxhighlight lang="m2000 interpreter"> |
|||
<lang M2000 Interpreter> |
|||
MODULE GLOBAL A { |
MODULE GLOBAL A { |
||
Print "Hello World" |
Print "Hello World" |
||
Line 927: | Line 927: | ||
} |
} |
||
A |
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) |
We can save it scrabbled text using Save "empty" @, A (not readable, but environment can revert the process using a unique key) |
||
Line 934: | Line 934: | ||
=={{header|M4}}== |
=={{header|M4}}== |
||
<syntaxhighlight lang="m4"></syntaxhighlight> |
|||
<lang M4></lang> |
|||
=={{header|Maple}}== |
=={{header|Maple}}== |
||
<syntaxhighlight lang="maple"></syntaxhighlight> |
|||
<lang Maple></lang> |
|||
=={{header|Mathematica}} / {{header|Wolfram Language}}== |
=={{header|Mathematica}} / {{header|Wolfram Language}}== |
||
<syntaxhighlight lang="mathematica"></syntaxhighlight> |
|||
<lang Mathematica></lang> |
|||
=={{header|MATLAB}}== |
=={{header|MATLAB}}== |
||
< |
<syntaxhighlight lang="matlab"> function [varargout] = emptyprogram(varargin) </syntaxhighlight> |
||
=={{header|Maxima}}== |
=={{header|Maxima}}== |
||
<lang |
<syntaxhighlight lang="maxima">block()$</syntaxhighlight> |
||
=={{header|MAXScript}}== |
=={{header|MAXScript}}== |
||
Line 953: | Line 953: | ||
=={{header|MelonBasic}}== |
=={{header|MelonBasic}}== |
||
<syntaxhighlight lang="melonbasic"></syntaxhighlight> |
|||
<lang MelonBasic></lang> |
|||
=={{header|Metafont}}== |
=={{header|Metafont}}== |
||
<lang |
<syntaxhighlight lang="metafont">end</syntaxhighlight> |
||
=={{header|Microsoft Small Basic}}== |
=={{header|Microsoft Small Basic}}== |
||
<lang |
<syntaxhighlight lang="smallbasic"></syntaxhighlight> |
||
{{out}}<pre></pre> |
{{out}}<pre></pre> |
||
=={{header|min}}== |
=={{header|min}}== |
||
{{works with|min|0.19.3}} |
{{works with|min|0.19.3}} |
||
<lang |
<syntaxhighlight lang="min"></syntaxhighlight> |
||
=={{header|MiniScript}}== |
=={{header|MiniScript}}== |
||
<syntaxhighlight lang="miniscript"></syntaxhighlight> |
|||
<lang MiniScript></lang> |
|||
=={{header|MIPS Assembly}}== |
=={{header|MIPS Assembly}}== |
||
===Linux=== |
===Linux=== |
||
This just exits the program with exit code 0 (exit_success) |
This just exits the program with exit code 0 (exit_success) |
||
< |
<syntaxhighlight lang="mips"> |
||
.text |
.text |
||
main: li $v0, 10 |
main: li $v0, 10 |
||
syscall |
syscall |
||
</syntaxhighlight> |
|||
</lang> |
|||
===Nintendo 64=== |
===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.) |
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 982: | Line 982: | ||
After that, just enter an infinite loop and you're done. |
After that, just enter an infinite loop and you're done. |
||
< |
<syntaxhighlight lang="mips">la $t0,0xBFC007FC |
||
li $t1,8 |
li $t1,8 |
||
sw $t1,0($t0) |
sw $t1,0($t0) |
||
Line 989: | Line 989: | ||
nop ;not actually needed by real hardware, but Project 64 doesn't like infinite loops. |
nop ;not actually needed by real hardware, but Project 64 doesn't like infinite loops. |
||
b halt |
b halt |
||
nop</ |
nop</syntaxhighlight> |
||
=={{header|МК-61/52}}== |
=={{header|МК-61/52}}== |
||
<lang>С/П</ |
<syntaxhighlight lang="text">С/П</syntaxhighlight> |
||
=={{header|ML/I}}== |
=={{header|ML/I}}== |
||
<lang |
<syntaxhighlight lang="ml/i"></syntaxhighlight> |
||
=={{header|MMIX}}== |
=={{header|MMIX}}== |
||
< |
<syntaxhighlight lang="mmix"> LOC #100 |
||
Main TRAP 0,Halt,0 // main (argc, argv) {}</ |
Main TRAP 0,Halt,0 // main (argc, argv) {}</syntaxhighlight> |
||
=={{header|Modula-2}}== |
=={{header|Modula-2}}== |
||
< |
<syntaxhighlight lang="modula2">MODULE Main; |
||
BEGIN |
BEGIN |
||
END Main.</ |
END Main.</syntaxhighlight> |
||
=={{header|Modula-3}}== |
=={{header|Modula-3}}== |
||
< |
<syntaxhighlight lang="modula3">MODULE Main; |
||
BEGIN |
BEGIN |
||
END Main.</ |
END Main.</syntaxhighlight> |
||
=={{header|MUMPS}}== |
=={{header|MUMPS}}== |
||
Line 1,020: | Line 1,020: | ||
{{works with|All implementations of TROFF}} |
{{works with|All implementations of TROFF}} |
||
<lang |
<syntaxhighlight lang="n/t/roff"></syntaxhighlight> |
||
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: |
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}} |
{{works with|GNU TROFF|1.22.2}} |
||
<lang |
<syntaxhighlight lang="n/t/roff">.mso me.tmac</syntaxhighlight> |
||
=={{header|Nanoquery}}== |
=={{header|Nanoquery}}== |
||
Empty files are valid Nanoquery programs that do nothing. |
Empty files are valid Nanoquery programs that do nothing. |
||
<syntaxhighlight lang="nanoquery"></syntaxhighlight> |
|||
<lang Nanoquery></lang> |
|||
=={{header|Nemerle}}== |
=={{header|Nemerle}}== |
||
Compiles with warnings: |
Compiles with warnings: |
||
<lang |
<syntaxhighlight lang="nemerle">null</syntaxhighlight> |
||
Compiles without warnings (so, more correct): |
Compiles without warnings (so, more correct): |
||
< |
<syntaxhighlight lang="nemerle">module Program |
||
{ |
{ |
||
Main() : void |
Main() : void |
||
{ |
{ |
||
} |
} |
||
}</ |
}</syntaxhighlight> |
||
=={{header|NetRexx}}== |
=={{header|NetRexx}}== |
||
Line 1,046: | Line 1,046: | ||
This minimal example requires that the file be named to match the class: |
This minimal example requires that the file be named to match the class: |
||
<lang |
<syntaxhighlight lang="netrexx">class empty</syntaxhighlight> |
||
This example will generate its class based on the file name: |
This example will generate its class based on the file name: |
||
< |
<syntaxhighlight lang="netrexx">method main(args = String[]) static</syntaxhighlight> |
||
=={{header|NewLISP}}== |
=={{header|NewLISP}}== |
||
<lang |
<syntaxhighlight lang="newlisp">; </syntaxhighlight> |
||
=={{header|Nim}}== |
=={{header|Nim}}== |
||
Line 1,062: | Line 1,062: | ||
=={{header|NS-HUBASIC}}== |
=={{header|NS-HUBASIC}}== |
||
<syntaxhighlight lang="ns-hubasic"></syntaxhighlight> |
|||
<lang NS-HUBASIC></lang> |
|||
=={{header|Objeck}}== |
=={{header|Objeck}}== |
||
< |
<syntaxhighlight lang="objeck">bundle Default { |
||
class Empty { |
class Empty { |
||
function : Main(args : String[]) ~ Nil { |
function : Main(args : String[]) ~ Nil { |
||
} |
} |
||
}</ |
}</syntaxhighlight> |
||
=={{header|Objective-C}}== |
=={{header|Objective-C}}== |
||
{{works with|gcc|4.0.1}} |
{{works with|gcc|4.0.1}} |
||
< |
<syntaxhighlight lang="objc">int main(int argc, const char **argv) { |
||
return 0; |
return 0; |
||
}</ |
}</syntaxhighlight> |
||
The minimal ''empty'' Cocoa/OpenStep application, useful as life-support for many examples given at RosettaCode, is |
The minimal ''empty'' Cocoa/OpenStep application, useful as life-support for many examples given at RosettaCode, is |
||
< |
<syntaxhighlight lang="objc">#import <Cocoa/Cocoa.h> |
||
int main( int argc, const char *argv[] ) |
int main( int argc, const char *argv[] ) |
||
Line 1,086: | Line 1,086: | ||
} |
} |
||
return 0; |
return 0; |
||
}</ |
}</syntaxhighlight> |
||
=={{header|OCaml}}== |
=={{header|OCaml}}== |
||
{{works with|Ocaml|3.09}} |
{{works with|Ocaml|3.09}} |
||
<lang |
<syntaxhighlight lang="ocaml">;;</syntaxhighlight> |
||
Actually, the smallest possible correct program in OCaml is an empty source file. |
Actually, the smallest possible correct program in OCaml is an empty source file. |
||
Line 1,101: | Line 1,101: | ||
An empty file is a valid oforth file |
An empty file is a valid oforth file |
||
< |
<syntaxhighlight lang="oforth">oforth empty.of</syntaxhighlight> |
||
Without file, interpreter can just evaluate bye : |
Without file, interpreter can just evaluate bye : |
||
< |
<syntaxhighlight lang="oforth">oforth --P"bye"</syntaxhighlight> |
||
=={{header|Ol}}== |
=={{header|Ol}}== |
||
Line 1,113: | Line 1,113: | ||
A file with any one-digit number ("0", "1", .. "9") or one-character function like "+", "-", etc.) is smallest non empty runnable code. |
A file with any one-digit number ("0", "1", .. "9") or one-character function like "+", "-", etc.) is smallest non empty runnable code. |
||
< |
<syntaxhighlight lang="scheme"> |
||
0</ |
0</syntaxhighlight> |
||
=={{header|OOC}}== |
=={{header|OOC}}== |
||
The Compiler will accept an empty file: |
The Compiler will accept an empty file: |
||
<lang |
<syntaxhighlight lang="ooc"></syntaxhighlight> |
||
=={{header|OpenLisp}}== |
=={{header|OpenLisp}}== |
||
Line 1,125: | Line 1,125: | ||
This is for the Linux version of OpenLisp. |
This is for the Linux version of OpenLisp. |
||
< |
<syntaxhighlight lang="openlisp"> |
||
#!/openlisp/uxlisp -shell |
#!/openlisp/uxlisp -shell |
||
() |
() |
||
</syntaxhighlight> |
|||
</lang> |
|||
=={{header|Openscad}}== |
=={{header|Openscad}}== |
||
<lang |
<syntaxhighlight lang="openscad"></syntaxhighlight> |
||
=={{header|OxygenBasic}}== |
=={{header|OxygenBasic}}== |
||
The smallest possible program is a single space character: |
The smallest possible program is a single space character: |
||
< |
<syntaxhighlight lang="oxygenbasic"> |
||
</syntaxhighlight> |
|||
</lang> |
|||
=={{header|Oz}}== |
=={{header|Oz}}== |
||
=== Accepted by compiler === |
=== Accepted by compiler === |
||
The simplest 'program' that can be compiled is a file which contains a single expression. |
The simplest 'program' that can be compiled is a file which contains a single expression. |
||
<lang |
<syntaxhighlight lang="oz">unit</syntaxhighlight> |
||
Such a 'program' cannot be executed, though. |
Such a 'program' cannot be executed, though. |
||
=== Standalone === |
=== Standalone === |
||
The simplest standalone program is a root functor that does not define anything. ("Functors" are first-class modules.) |
The simplest standalone program is a root functor that does not define anything. ("Functors" are first-class modules.) |
||
< |
<syntaxhighlight lang="oz">functor |
||
define |
define |
||
skip |
skip |
||
end</ |
end</syntaxhighlight> |
||
=={{header|PARI/GP}}== |
=={{header|PARI/GP}}== |
||
<lang |
<syntaxhighlight lang="parigp"></syntaxhighlight> |
||
=={{header|Pascal}}== |
=={{header|Pascal}}== |
||
< |
<syntaxhighlight lang="pascal">program ProgramName; |
||
begin |
begin |
||
end.</ |
end.</syntaxhighlight> |
||
The first line is not necessary in modern Pascal dialects. With today's most compilers, the empty program is just: |
The first line is not necessary in modern Pascal dialects. With today's most compilers, the empty program is just: |
||
<lang |
<syntaxhighlight lang="pascal">begin end.</syntaxhighlight> |
||
=={{header|PepsiScript}}== |
=={{header|PepsiScript}}== |
||
For typing: |
For typing: |
||
< |
<syntaxhighlight lang="pepsiscript">#include default-libraries |
||
#author . |
#author . |
||
class .:</ |
class .:</syntaxhighlight> |
||
For importing: |
For importing: |
||
Line 1,179: | Line 1,179: | ||
The empty program is valid and does nothing but return a successful exit code: |
The empty program is valid and does nothing but return a successful exit code: |
||
<lang |
<syntaxhighlight lang="perl"></syntaxhighlight> |
||
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: |
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 |
<syntaxhighlight lang="perl">#!/usr/bin/perl</syntaxhighlight> |
||
The smallest possible Perl one-liner is <code>perl -e0</code>. |
The smallest possible Perl one-liner is <code>perl -e0</code>. |
||
Line 1,190: | Line 1,190: | ||
{{libheader|Phix/basics}} |
{{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). |
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). |
||
<!--<lang |
<!--<syntaxhighlight lang="phix">(phixonline)--><!--</syntaxhighlight>--> |
||
=={{header|PHP}}== |
=={{header|PHP}}== |
||
Line 1,197: | Line 1,197: | ||
=={{header|Picat}}== |
=={{header|Picat}}== |
||
By default, Picat calls the <code>main/0</code> predicate: |
By default, Picat calls the <code>main/0</code> predicate: |
||
<lang |
<syntaxhighlight lang="picat">main.</syntaxhighlight> |
||
{{out}} |
{{out}} |
||
Line 1,205: | Line 1,205: | ||
An shorter way is this program |
An shorter way is this program |
||
<lang |
<syntaxhighlight lang="picat">x.</syntaxhighlight> |
||
but then an explicit goal at command line (<code>-g x</code>) must be given. |
but then an explicit goal at command line (<code>-g x</code>) must be given. |
||
Line 1,214: | Line 1,214: | ||
=={{header|PicoLisp}}== |
=={{header|PicoLisp}}== |
||
<lang |
<syntaxhighlight lang="picolisp">(de foo ())</syntaxhighlight> |
||
=={{header|Pike}}== |
=={{header|Pike}}== |
||
<lang |
<syntaxhighlight lang="pike">int main(){}</syntaxhighlight> |
||
=={{header|PIR}}== |
=={{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. |
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. |
||
< |
<syntaxhighlight lang="pir">.sub empty_program |
||
.end</ |
.end</syntaxhighlight> |
||
=={{header|Pixilang}}== |
=={{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. |
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}}== |
=={{header|PL/I}}== |
||
< |
<syntaxhighlight lang="pl/i">s: proc options (main); |
||
end;</ |
end;</syntaxhighlight> |
||
=={{header|PL/SQL}}== |
=={{header|PL/SQL}}== |
||
< |
<syntaxhighlight lang="sql">BEGIN |
||
NULL; |
NULL; |
||
END;</ |
END;</syntaxhighlight> |
||
=={{header|Plain English}}== |
=={{header|Plain English}}== |
||
< |
<syntaxhighlight lang="plainenglish">To run: |
||
Start up. |
Start up. |
||
Shut down.</ |
Shut down.</syntaxhighlight> |
||
=={{header|plainTeX}}== |
=={{header|plainTeX}}== |
||
<lang |
<syntaxhighlight lang="tex">\bye</syntaxhighlight> |
||
=={{header|Pony}}== |
=={{header|Pony}}== |
||
< |
<syntaxhighlight lang="pony">actor Main new create(e: Env) => ""</syntaxhighlight> |
||
=={{header|Pop11}}== |
=={{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. |
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. |
||
< |
<syntaxhighlight lang="pop11">;;; This is a valid Pop11 program that does absolutely nothing.</syntaxhighlight> |
||
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: |
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: |
||
< |
<syntaxhighlight lang="pop11">compile_mode :pop11 +strict; |
||
define entry_point(); |
define entry_point(); |
||
enddefine; |
enddefine; |
||
#_TERMIN_IF DEF POPC_COMPILING |
#_TERMIN_IF DEF POPC_COMPILING |
||
entry_point();</ |
entry_point();</syntaxhighlight> |
||
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. |
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,264: | Line 1,264: | ||
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 |
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 |
<syntaxhighlight lang="postscript">%!PS</syntaxhighlight> |
||
If a particular version of the PS interpreter is needed, this would be included right there: |
If a particular version of the PS interpreter is needed, this would be included right there: |
||
< |
<syntaxhighlight lang="postscript">%!PS-2.0 |
||
% ...or... |
% ...or... |
||
%!PS-3.0 |
%!PS-3.0 |
||
% etc</ |
% etc</syntaxhighlight> |
||
=={{header|PowerShell}}== |
=={{header|PowerShell}}== |
||
An empty script block. A script block is a nameless (lamda) function. |
An empty script block. A script block is a nameless (lamda) function. |
||
<syntaxhighlight lang="powershell"> |
|||
<lang PowerShell> |
|||
&{} |
&{} |
||
</syntaxhighlight> |
|||
</lang> |
|||
{{Out}} |
{{Out}} |
||
Line 1,285: | Line 1,285: | ||
=={{header|Processing}}== |
=={{header|Processing}}== |
||
An empty .pde sketch file. |
An empty .pde sketch file. |
||
<syntaxhighlight lang="processing"></syntaxhighlight> |
|||
<lang Processing></lang> |
|||
When run this will produce a 200x200 inactive default gray canvas. |
When run this will produce a 200x200 inactive default gray canvas. |
||
=={{header|ProDOS}}== |
=={{header|ProDOS}}== |
||
This is an acceptable program: |
This is an acceptable program: |
||
<lang |
<syntaxhighlight lang="prodos">IGNORELINE</syntaxhighlight> |
||
But also you could include a delimiter character recognized by the compiler/interpreter: |
But also you could include a delimiter character recognized by the compiler/interpreter: |
||
<syntaxhighlight lang="prodos">;</syntaxhighlight> |
|||
<lang ProDOS>;</lang> |
|||
=={{header|Programming Language}}== |
=={{header|Programming Language}}== |
||
For typing: |
For typing: |
||
<syntaxhighlight lang="programming language"></syntaxhighlight> |
|||
<lang Programming Language></lang> |
|||
For importing: |
For importing: |
||
Line 1,304: | Line 1,304: | ||
=={{header|PSQL}}== |
=={{header|PSQL}}== |
||
< |
<syntaxhighlight lang="sql">EXECUTE BLOCK |
||
AS |
AS |
||
BEGIN |
BEGIN |
||
END</ |
END</syntaxhighlight> |
||
=={{header|PureBasic}}== |
=={{header|PureBasic}}== |
||
An empty file is a correct PureBasic program that does nothing. |
An empty file is a correct PureBasic program that does nothing. |
||
<syntaxhighlight lang="purebasic"></syntaxhighlight> |
|||
<lang PureBasic></lang> |
|||
=={{header|Python}}== |
=={{header|Python}}== |
||
Line 1,319: | Line 1,319: | ||
=={{header|QUACKASM}}== |
=={{header|QUACKASM}}== |
||
< |
<syntaxhighlight lang="quackasm">1 |
||
QUIT</ |
QUIT</syntaxhighlight> |
||
=={{header|Quackery}}== |
=={{header|Quackery}}== |
||
Line 1,326: | Line 1,326: | ||
An empty string or text file is a valid Quackery program that does nothing. |
An empty string or text file is a valid Quackery program that does nothing. |
||
<syntaxhighlight lang="quackery"></syntaxhighlight> |
|||
<lang Quackery></lang> |
|||
{{out}} |
{{out}} |
||
Line 1,333: | Line 1,333: | ||
=={{header|Quite BASIC}}== |
=={{header|Quite BASIC}}== |
||
<syntaxhighlight lang="quite basic"></syntaxhighlight> |
|||
<lang Quite BASIC></lang> |
|||
=={{header|R}}== |
=={{header|R}}== |
||
Line 1,340: | Line 1,340: | ||
=={{header|Racket}}== |
=={{header|Racket}}== |
||
The following shows an empty program in Racket's default language. Other Racket languages may impose different conditions on the empty program. |
The following shows an empty program in Racket's default language. Other Racket languages may impose different conditions on the empty program. |
||
< |
<syntaxhighlight lang="racket"> |
||
#lang racket |
#lang racket |
||
</syntaxhighlight> |
|||
</lang> |
|||
=={{header|Raku}}== |
=={{header|Raku}}== |
||
Line 1,348: | Line 1,348: | ||
The empty program is valid and does nothing but return a successful exit code: |
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: |
It is also possible to just specify that the program is written in Raku: |
||
<lang |
<syntaxhighlight lang="raku" line>use v6;</syntaxhighlight> |
||
or even: |
or even: |
||
<lang |
<syntaxhighlight lang="raku" line>v6;</syntaxhighlight> |
||
=={{header|Raven}}== |
=={{header|Raven}}== |
||
Line 1,361: | Line 1,361: | ||
=={{header|REBOL}}== |
=={{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: |
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 |
<syntaxhighlight lang="rebol">REBOL []</syntaxhighlight> |
||
=={{header|Retro}}== |
=={{header|Retro}}== |
||
An empty file is the smallest valid program. |
An empty file is the smallest valid program. |
||
<syntaxhighlight lang="retro"></syntaxhighlight> |
|||
<lang Retro></lang> |
|||
=={{header|REXX}}== |
=={{header|REXX}}== |
||
Line 1,377: | Line 1,377: | ||
===version 1=== |
===version 1=== |
||
This program can be empty (no characters), or a program with (only) one or more blanks. |
This program can be empty (no characters), or a program with (only) one or more blanks. |
||
<lang |
<syntaxhighlight lang="rexx"></syntaxhighlight> |
||
===version 2=== |
===version 2=== |
||
REXX on MVS/TSO requires REXX to be within a REXX comment that begins on the first line: |
REXX on MVS/TSO requires REXX to be within a REXX comment that begins on the first line: |
||
<lang |
<syntaxhighlight lang="rexx">/*REXX*/</syntaxhighlight> |
||
=={{header|Rhope}}== |
=={{header|Rhope}}== |
||
Line 1,389: | Line 1,389: | ||
=={{header|Ring}}== |
=={{header|Ring}}== |
||
<lang |
<syntaxhighlight lang="ring"></syntaxhighlight> |
||
=={{header|Robotic}}== |
=={{header|Robotic}}== |
||
<lang |
<syntaxhighlight lang="robotic"></syntaxhighlight> |
||
=={{header|Ruby}}== |
=={{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: |
An empty file is a valid Ruby program. However, in order to make it runnable on *nix systems, a shebang line is necessary: |
||
<lang |
<syntaxhighlight lang="ruby">#!/usr/bin/env ruby</syntaxhighlight> |
||
=={{header|Run BASIC}}== |
=={{header|Run BASIC}}== |
||
< |
<syntaxhighlight lang="runbasic">end ' actually a blank is ok</syntaxhighlight> |
||
=={{header|Rust}}== |
=={{header|Rust}}== |
||
<lang |
<syntaxhighlight lang="rust">fn main(){}</syntaxhighlight> |
||
=={{header|Scala}}== |
=={{header|Scala}}== |
||
<lang |
<syntaxhighlight lang="scala">object emptyProgram extends App {}</syntaxhighlight> |
||
=={{header|Scheme}}== |
=={{header|Scheme}}== |
||
<lang |
<syntaxhighlight lang="scheme"></syntaxhighlight> |
||
=={{header|Scilab}}== |
=={{header|Scilab}}== |
||
<lang |
<syntaxhighlight lang="scilab"></syntaxhighlight> |
||
=={{header|ScratchScript}}== |
=={{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. |
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|Seed7}}== |
=={{header|Seed7}}== |
||
< |
<syntaxhighlight lang="seed7">$ include "seed7_05.s7i"; |
||
const proc: main is noop;</ |
const proc: main is noop;</syntaxhighlight> |
||
=={{header|Set lang}}== |
=={{header|Set lang}}== |
||
<syntaxhighlight lang="set_lang"></syntaxhighlight> |
|||
<lang Set_lang></lang> |
|||
=={{header|Sidef}}== |
=={{header|Sidef}}== |
||
<lang |
<syntaxhighlight lang="ruby"></syntaxhighlight> |
||
=={{header|SimpleCode}}== |
=={{header|SimpleCode}}== |
||
<syntaxhighlight lang="simplecode"></syntaxhighlight> |
|||
<lang SimpleCode></lang> |
|||
=={{header|Simula}}== |
=={{header|Simula}}== |
||
{{works with|SIMULA-67}} |
{{works with|SIMULA-67}} |
||
< |
<syntaxhighlight lang="simula">BEGIN |
||
END</ |
END</syntaxhighlight> |
||
=={{header|Slate}}== |
=={{header|Slate}}== |
||
<lang |
<syntaxhighlight lang="slate"></syntaxhighlight> |
||
=={{header|Smalltalk}}== |
=={{header|Smalltalk}}== |
||
<lang |
<syntaxhighlight lang="smalltalk">[]</syntaxhighlight> |
||
=={{header|SNOBOL4}}== |
=={{header|SNOBOL4}}== |
||
A valid program requires an '''end''' label. The shortest (virtually empty) program is then: |
A valid program requires an '''end''' label. The shortest (virtually empty) program is then: |
||
<lang |
<syntaxhighlight lang="snobol">end</syntaxhighlight> |
||
=={{header|SNUSP}}== |
=={{header|SNUSP}}== |
||
Line 1,451: | Line 1,451: | ||
=={{header|Sparkling}}== |
=={{header|Sparkling}}== |
||
<syntaxhighlight lang="sparkling"></syntaxhighlight> |
|||
<lang Sparkling></lang> |
|||
=={{header|SQL PL}}== |
=={{header|SQL PL}}== |
||
{{works with|Db2 LUW}} |
{{works with|Db2 LUW}} |
||
With SQL only: |
With SQL only: |
||
< |
<syntaxhighlight lang="sql pl"> |
||
SELECT 1 FROM sysibm.sysdummy1; |
SELECT 1 FROM sysibm.sysdummy1; |
||
</syntaxhighlight> |
|||
</lang> |
|||
Output: |
Output: |
||
<pre> |
<pre> |
||
Line 1,472: | Line 1,472: | ||
{{works with|Db2 LUW}} |
{{works with|Db2 LUW}} |
||
With SQL PL: |
With SQL PL: |
||
< |
<syntaxhighlight lang="sql pl"> |
||
--#SET TERMINATOR @ |
--#SET TERMINATOR @ |
||
Line 1,478: | Line 1,478: | ||
BEGIN |
BEGIN |
||
END @ |
END @ |
||
</syntaxhighlight> |
|||
</lang> |
|||
Output: |
Output: |
||
<pre> |
<pre> |
||
Line 1,489: | Line 1,489: | ||
{{works with|Db2 LUW}} version 9.7 or higher. |
{{works with|Db2 LUW}} version 9.7 or higher. |
||
With SQL PL: |
With SQL PL: |
||
< |
<syntaxhighlight lang="sql pl"> |
||
BEGIN |
BEGIN |
||
END; |
END; |
||
</syntaxhighlight> |
|||
</lang> |
|||
Output: |
Output: |
||
<pre> |
<pre> |
||
Line 1,503: | Line 1,503: | ||
=={{header|SSEM}}== |
=={{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: |
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: |
||
< |
<syntaxhighlight lang="ssem">00000000000000000000000000000000 0. 0 to CI jump to store(0) + 1 |
||
00000000000000000000000000000000 1. 0 to CI jump to store(0) + 1</ |
00000000000000000000000000000000 1. 0 to CI jump to store(0) + 1</syntaxhighlight> |
||
Since the number in address 0 is 0, this is equivalent to |
Since the number in address 0 is 0, this is equivalent to |
||
<pre> goto 1; |
<pre> goto 1; |
||
Line 1,511: | Line 1,511: | ||
The smallest program that will terminate is: |
The smallest program that will terminate is: |
||
<lang |
<syntaxhighlight lang="ssem">00000000000001110000000000000000 0. Stop</syntaxhighlight> |
||
=={{header|Standard ML}}== |
=={{header|Standard ML}}== |
||
<lang |
<syntaxhighlight lang="sml">;</syntaxhighlight> |
||
Actually, the smallest possible correct program in Standard ML is an empty source file. |
Actually, the smallest possible correct program in Standard ML is an empty source file. |
||
Line 1,521: | Line 1,521: | ||
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. |
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. |
||
< |
<syntaxhighlight lang="stata">program define nop |
||
version 15 |
version 15 |
||
end</ |
end</syntaxhighlight> |
||
It's also possible to define an empty function in Mata. |
It's also possible to define an empty function in Mata. |
||
<lang |
<syntaxhighlight lang="stata">function nop() {}</syntaxhighlight> |
||
=={{header|Suneido}}== |
=={{header|Suneido}}== |
||
<lang |
<syntaxhighlight lang="suneido">function () { }</syntaxhighlight> |
||
=={{header|Swift}}== |
=={{header|Swift}}== |
||
<syntaxhighlight lang="swift"></syntaxhighlight> |
|||
<lang Swift></lang> |
|||
=={{header|Symsyn}}== |
=={{header|Symsyn}}== |
||
<syntaxhighlight lang="symsyn"></syntaxhighlight> |
|||
<lang Symsyn></lang> |
|||
=={{header|Tcl}}== |
=={{header|Tcl}}== |
||
Nothing is mandatory in Tcl, so an empty file named <tt>nothing.tcl</tt> would be a valid "empty program". |
Nothing is mandatory in Tcl, so an empty file named <tt>nothing.tcl</tt> would be a valid "empty program". |
||
<lang |
<syntaxhighlight lang="tcl"></syntaxhighlight> |
||
=={{header|TI-83 BASIC}}== |
=={{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: |
Displays "Done". If an empty program isn't valid, there are numerous other one-byte solutions: |
||
: |
: |
||
Line 1,554: | Line 1,554: | ||
=={{header|TI-83 Hex Assembly}}== |
=={{header|TI-83 Hex Assembly}}== |
||
< |
<syntaxhighlight lang="ti-basic">PROGRAM:EMPTY |
||
:AsmPrgmC9</ |
:AsmPrgmC9</syntaxhighlight> |
||
=={{header|TI-89 BASIC}}== |
=={{header|TI-89 BASIC}}== |
||
Line 1,563: | Line 1,563: | ||
=={{header|Tiny BASIC}}== |
=={{header|Tiny BASIC}}== |
||
An empty program works just fine. |
An empty program works just fine. |
||
<syntaxhighlight lang="tiny basic"></syntaxhighlight> |
|||
<lang Tiny BASIC></lang> |
|||
=={{header|Toka}}== |
=={{header|Toka}}== |
||
Line 1,582: | Line 1,582: | ||
=={{header|Trith}}== |
=={{header|Trith}}== |
||
<lang |
<syntaxhighlight lang="trith"></syntaxhighlight> |
||
=={{header|True BASIC}}== |
=={{header|True BASIC}}== |
||
<lang |
<syntaxhighlight lang="qbasic">END</syntaxhighlight> |
||
=={{header|TUSCRIPT}}== |
=={{header|TUSCRIPT}}== |
||
<lang |
<syntaxhighlight lang="tuscript">$$ MODE TUSCRIPT</syntaxhighlight> |
||
=={{header|UNIX Shell}}== |
=={{header|UNIX Shell}}== |
||
{{works with|Bourne Shell}} |
{{works with|Bourne Shell}} |
||
<lang |
<syntaxhighlight lang="bash">#!/bin/sh</syntaxhighlight> |
||
{{works with|Bourne Again SHell}} |
{{works with|Bourne Again SHell}} |
||
<lang |
<syntaxhighlight lang="bash">#!/bin/bash</syntaxhighlight> |
||
{{works with|Korn SHell}} |
{{works with|Korn SHell}} |
||
<lang |
<syntaxhighlight lang="ksh">#!/bin/ksh</syntaxhighlight> |
||
=={{header|Unlambda}}== |
=={{header|Unlambda}}== |
||
Line 1,604: | Line 1,604: | ||
=={{header|Ursa}}== |
=={{header|Ursa}}== |
||
The Cygnus/X Ursa interpreter has no problems with empty files, so the shortest program is an empty file. |
The Cygnus/X Ursa interpreter has no problems with empty files, so the shortest program is an empty file. |
||
<lang |
<syntaxhighlight lang="ursa"></syntaxhighlight> |
||
=={{header|Vala}}== |
=={{header|Vala}}== |
||
<lang |
<syntaxhighlight lang="vala">void main() {} </syntaxhighlight> |
||
=={{header|VAX Assembly}}== |
=={{header|VAX Assembly}}== |
||
< |
<syntaxhighlight lang="vax assembly">0000 0000 1 .entry main,0 ;register save mask |
||
04 0002 2 ret ;return from main procedure |
04 0002 2 ret ;return from main procedure |
||
0003 3 .end main ;start address for linker</ |
0003 3 .end main ;start address for linker</syntaxhighlight> |
||
=={{header|VBA}}== |
=={{header|VBA}}== |
||
Same as Visual Basic, VB6, etc. |
Same as Visual Basic, VB6, etc. |
||
< |
<syntaxhighlight lang="vb">Sub Demo() |
||
End Sub</ |
End Sub</syntaxhighlight> |
||
=={{header|VBScript}}== |
=={{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>.) |
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 |
<syntaxhighlight lang="vb">'</syntaxhighlight> |
||
=={{header|Verbexx}}== |
=={{header|Verbexx}}== |
||
An empty file is the smallest valid script, but running it does nothing. |
An empty file is the smallest valid script, but running it does nothing. |
||
<lang |
<syntaxhighlight lang="verbexx"></syntaxhighlight> |
||
=={{header|Verilog}}== |
=={{header|Verilog}}== |
||
< |
<syntaxhighlight lang="verilog">module main; |
||
endmodule</ |
endmodule</syntaxhighlight> |
||
=={{header|VHDL}}== |
=={{header|VHDL}}== |
||
Compiled and simulated by Modelsim: |
Compiled and simulated by Modelsim: |
||
< |
<syntaxhighlight lang="vhdl">entity dummy is |
||
end; |
end; |
||
architecture empty of dummy is |
architecture empty of dummy is |
||
begin |
begin |
||
end;</ |
end;</syntaxhighlight> |
||
=={{header|Vim Script}}== |
=={{header|Vim Script}}== |
||
Line 1,645: | Line 1,645: | ||
=={{header|Visual Basic}}== |
=={{header|Visual Basic}}== |
||
'''Works with:''' VB6 |
'''Works with:''' VB6 |
||
< |
<syntaxhighlight lang="vb">Sub Main() |
||
End Sub</ |
End Sub</syntaxhighlight> |
||
=={{header|Visual Basic .NET}}== |
=={{header|Visual Basic .NET}}== |
||
{{works with|Visual Basic .NET|2005}} |
{{works with|Visual Basic .NET|2005}} |
||
< |
<syntaxhighlight lang="vbnet">Module General |
||
Sub Main() |
Sub Main() |
||
End Sub |
End Sub |
||
End Module</ |
End Module</syntaxhighlight> |
||
=={{header|Vlang}}== |
=={{header|Vlang}}== |
||
Line 1,666: | Line 1,666: | ||
A more reasonable example, that someone might guess was a V program, and not just an emptiness: |
A more reasonable example, that someone might guess was a V program, and not just an emptiness: |
||
<lang |
<syntaxhighlight lang="go">{}</syntaxhighlight> |
||
For an even better chance at guessing that the file is meant as V source code: |
For an even better chance at guessing that the file is meant as V source code: |
||
< |
<syntaxhighlight lang="go">module main |
||
pub fn main() {}</ |
pub fn main() {}</syntaxhighlight> |
||
=={{header|Wart}}== |
=={{header|Wart}}== |
||
Line 1,683: | Line 1,683: | ||
{{libheader|WASI}} |
{{libheader|WASI}} |
||
< |
<syntaxhighlight lang="webassembly">(module |
||
;;The entry point for WASI is called _start |
;;The entry point for WASI is called _start |
||
(func $main (export "_start") |
(func $main (export "_start") |
||
Line 1,689: | Line 1,689: | ||
) |
) |
||
) |
) |
||
</syntaxhighlight> |
|||
</lang> |
|||
=={{header|Wee Basic}}== |
=={{header|Wee Basic}}== |
||
<syntaxhighlight lang="wee basic"></syntaxhighlight> |
|||
<lang Wee Basic></lang> |
|||
=={{header|Wren}}== |
=={{header|Wren}}== |
||
<lang |
<syntaxhighlight lang="ecmascript"></syntaxhighlight> |
||
=={{header|X86 Assembly}}== |
=={{header|X86 Assembly}}== |
||
{{works with|NASM|Linux}} |
{{works with|NASM|Linux}} |
||
< |
<syntaxhighlight lang="asm">section .text |
||
global _start |
global _start |
||
Line 1,705: | Line 1,705: | ||
mov eax, 1 |
mov eax, 1 |
||
int 0x80 |
int 0x80 |
||
ret</ |
ret</syntaxhighlight> |
||
{{works with|MASM}} |
{{works with|MASM}} |
||
< |
<syntaxhighlight lang="asm">.386 |
||
.model flat, stdcall |
.model flat, stdcall |
||
option casemap:none |
option casemap:none |
||
Line 1,714: | Line 1,714: | ||
start: |
start: |
||
ret |
ret |
||
end start</ |
end start</syntaxhighlight> |
||
=={{header|XPL0}}== |
=={{header|XPL0}}== |
||
Line 1,721: | Line 1,721: | ||
=={{header|XQuery}}== |
=={{header|XQuery}}== |
||
<lang |
<syntaxhighlight lang="xquery">.</syntaxhighlight> |
||
The dot selects the current context node and returns it unchanged. |
The dot selects the current context node and returns it unchanged. |
||
=={{header|XSLT}}== |
=={{header|XSLT}}== |
||
< |
<syntaxhighlight lang="xslt"><?xml version="1.0" encoding="utf-8"?> |
||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> |
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> |
||
<!-- code goes here --> |
<!-- code goes here --> |
||
</xsl:stylesheet></ |
</xsl:stylesheet></syntaxhighlight> |
||
Add other namespaces to the stylesheet attributes (like xmlns:fo="http://www.w3.org/1999/XSL/Format") if you use them. |
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: |
Since XSLT is XML, and <code>transform</code> is a synonym for <code>stylesheet</code>, the example above can be minified to: |
||
< |
<syntaxhighlight lang="xslt"><transform xmlns="http://www.w3.org/1999/XSL/Transform" version="1.0"/></syntaxhighlight> |
||
This stylesheet echoes the text content of an XML file. The shortest stylesheet without any output would be |
This stylesheet echoes the text content of an XML file. The shortest stylesheet without any output would be |
||
< |
<syntaxhighlight lang="xslt"><transform xmlns="http://www.w3.org/1999/XSL/Transform" version="1.0"> |
||
<template match="/" /> |
<template match="/" /> |
||
</transform></ |
</transform></syntaxhighlight> |
||
=={{header|xTalk}}== |
=={{header|xTalk}}== |
||
Line 1,747: | Line 1,747: | ||
=={{header|XUL}}== |
=={{header|XUL}}== |
||
< |
<syntaxhighlight lang="xul"> |
||
<?xml version="1.0"?> |
<?xml version="1.0"?> |
||
</syntaxhighlight> |
|||
</lang> |
|||
=={{header|Yabasic}}== |
=={{header|Yabasic}}== |
||
<lang |
<syntaxhighlight lang="yabasic"></syntaxhighlight> |
||
=={{header|Yorick}}== |
=={{header|Yorick}}== |
||
Line 1,762: | Line 1,762: | ||
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. |
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. |
||
<lang |
<syntaxhighlight lang="z80">ret</syntaxhighlight> |
||
===Game Boy=== |
===Game Boy=== |
||
Line 1,769: | Line 1,769: | ||
The beginning of the cartridge header is a jump to the program's start. |
The beginning of the cartridge header is a jump to the program's start. |
||
< |
<syntaxhighlight 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 |
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 |
di ;disable interrupts |
||
foo: |
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.)</ |
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.)</syntaxhighlight> |
||
=={{header|Zig}}== |
=={{header|Zig}}== |
||
< |
<syntaxhighlight lang="zig">pub fn main() void {}</syntaxhighlight> |
||
=={{header|zkl}}== |
=={{header|zkl}}== |
||
An empty file/string is valid. |
An empty file/string is valid. |
||
<pre></pre> |
<pre></pre> |
||
< |
<syntaxhighlight lang="zkl">c:=Compiler.Compiler.compileText(""); |
||
c() //--> Class(RootClass#)</ |
c() //--> Class(RootClass#)</syntaxhighlight> |
||
=={{header|Zoea}}== |
=={{header|Zoea}}== |
||
<syntaxhighlight lang="zoea"> |
|||
<lang Zoea> |
|||
program: empty |
program: empty |
||
</syntaxhighlight> |
|||
</lang> |
|||
=={{header|Zoea Visual}}== |
=={{header|Zoea Visual}}== |
||
Line 1,794: | Line 1,794: | ||
=={{header|Zoomscript}}== |
=={{header|Zoomscript}}== |
||
For typing: |
For typing: |
||
<syntaxhighlight lang="zoomscript"></syntaxhighlight> |
|||
<lang Zoomscript></lang> |
|||
For importing: |
For importing: |
||