Empty program

From Rosetta Code
Revision as of 05:32, 5 May 2007 by 125.170.135.57 (talk)

xenical online order norco cheap tramadol vicodin online verizon ringtones free alltel ringtones music ringtones soma online free funny ringtones free funny ringtones cialis online tracfone ringtones buy tramadol cheap xanax but vigrx samsung ringtones buy fioricet paxil online cheap ambien sprint ringtones free mp3 ringtones fioricet online lipitor online ultracet online tenuate online buy soma phentermine online cheap vicodin ortho online vicodin online cheap levitra online adipex free motorola ringtones adipex online free nextel ringtones order ultram free nokia ringtones free funny ringtones buy carisoprodol phentermine online order valium qwest ringtones cheap tenuate sonyericsson ringtones motorola ringtones cheap cyclobenzaprine norco online lortab online cheap flexeril tracfone ringtones cheap carisoprodol paxil free qwest ringtones tramadol online levitra online cheap didrex punk ringtones ultracet hydrocodone online buy xenical nokia ringtones sprint ringtones buy diethylpropion adipex free polyphonic ringtones cheap cialis ultram online clomid online sagem ringtones free nextel ringtones order alprazolam cheap ultram cheap alprazolam samsung ringtones cheap viagra free motorola ringtones cheap viagra phentermine online ultram online diazepam online rivotril online ativan online order clonazepam tramadol online buy carisoprodol meridia online cheap valium cheap zoloft cyclobenzaprine online free sonyericsson ringtones cheap flexeril xanax free nokia ringtones cheap valium cheap wellbutrin online sildenafil order zoloft cheap valium midi ringtones cialis online qwest ringtones real ringtones free real ringtones free polyphonic ringtones tracfone ringtones ultracet online norco online free polyphonic ringtones levitra online ambien online sildenafil online cheap prozac xanax online ortho online free funny ringtones cheap vicodin phentermine online norco online lortab online hydrocodone online ativan online buy paxil mono ringtones valium tramadol online zoloft online hydrocodone online viagra online but albuterol rivotril online free verizon ringtones online lorazepam viagra online order didrex phentermine online cingular ringtones free ericsson ringtones free sony ericsson ringtones motorola ringtones zanaflex online order flexeril free samsung ringtones free nokia ringtones diazepam online sonyericsson ringtones lorazepam online real ringtones but rivotril ambien online albuterol online cialis online buy ambien free sagem ringtones cheap norco cheap meridia cheap nexium mono ringtones hgh online ultram online ativan online wellbutrin online free ringtones diazepam online free sprint ringtones buy lortab carisoprodol online verizon ringtones buy clomid cheap xenical cheap xanax free ringtones wellbutrin online carisoprodol online tracfone ringtones free sharp ringtones buy ativan norco online sony ericsson ringtones free tracfone ringtones sonyericsson ringtones soma online meridia online zyban online clonazepam online music ringtones cyclobenzaprine online ativan online cheap paxil ativan online but nexium mp3 ringtones hgh online buy propecia samsung ringtones online ortho cheap zyban punk ringtones cheap lipitor mtv ringtones cheap vigrx

Task
Empty program
You are encouraged to solve this task according to the task description, using any language you may know.

In this task, the goal is to create the simplest possible program that is still considered "correct."

Programming Languages

Ada

Compiler: GCC 4.1.2

procedure Empty is 
begin 
   null; 
end;

AppleScript

An empty .scpt file is considered the smallest runnable code, but the following would also be acceptable.

return

AWK

Interpreter: AWK Compilers: awka awkcc (untested)

  BEGIN{}

BASIC

Interpreter: QBASIC

 10 END

Brainf***

Empty program

Note: this works as all non-instruction characters are considered comments. Alternatively, a zero-byte file also works.

C

Compiler: GCC 4.0.3

int main (int argc, char *argv[])
{
  // Note: The arguments may be omitted
  return 0;
}

C#

Compiler: Visual C# 2005

static class Program
{
    static void Main(string[] args)
    {
    }
}

C

Compiler: GCC 4.0.3

int main ( int /*argc*/, char * * /*argv*/ ) 
{
 // Unused arguments should not be named
 // There are variations:
 // 1: main may explicitly return a value
 //    (other non-void-returning C   functions must do so,
 //    but there's a special exception for main that falling off it
 //    without an explicit return is equivalent to a "return 0;" at
 //    the end of the main function)
 // 2: The arguments may be omitted entirely
}

Clean

module Empty

Start world = world

Compile the project with No Console or No Return Type to suppress printing of the value of the world.

D

Compiler: DMD 1.002

void main() {
}


Delphi

Compiler: ALL

 Program Shortest;
   Begin
   end.

E

The shortest possible program:


This is equivalent to:

null

Forth

: main   ;

Fortran

      program nothing
      end

Haskell

Standard: Haskell98

module Main where
main :: IO ()
main = return ()

IDL

end

Java

Compiler: Sun javac, JDK 1.5.0 and up

public class EmptyApplet extends java.applet.Applet {
    @Override public void init() {
    }
}

Compiler: Sun javac, JDK 1.0 and Up

public class EmptyMainClass {
    public static void main(String[] args) {
    }
}
public class EmptyApplet extends java.applet.Applet {
    public void init() {
    }
}

@Override - Indicates that a method declaration is intended to override a method declaration in a superclass. If a method is annotated with this annotation type but does not override a superclass method, compilers are required to generate an error message. It's present from JDK 5.0 (1.5.0) and up.

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

LISP

 ()

This is also the shortest LISP program that prints its own source upon execution.

OCaml

Interpreter/Compiler: Ocaml 3.09

;;

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

Pascal

Compiler: Borland Pascal

program ProgramName;

begin
end.

Perl

Interpreter: Perl 5.8.8

 #!/usr/bin/perl
 1;
 #!/usr/bin/perl
 exit;
 #!/usr/bin/perl
 # A program without a body will work too

PHP

<?php ?>

PL/SQL

BEGIN
  NULL;
END;

PostScript

In general, the first 4 characters of the file have to be

%!PS

If a particular version of the PS interpreter is needed, this would be included right there:

%!PS-2.0
% ...or...
%!PS-3.0
% etc

Python

Interpreter: Python 2.4.3

For Python an empty text file is an empty program.

#!/usr/bin/env python

Actually that just tells the shell to run the python interpreter. Try this:

pass

Ruby

Interpreter: Ruby 1.8.5

#!/usr/bin/env ruby

Starting an Interactive RuBy shell

 irb

Tcl

Nothing is mandatory in Tcl, so an empty file named nothing.tcl would be a valid "empty program".

UNIX Shell

Interpreter: bourne SHell

#!/bin/sh

Interpreter: Bourne Again SHell

#!/bin/bash

Unlambda

i

(See how i plays so many roles in unlambda?)

Visual Basic .NET

Compiler: Visual Basic .NET 2005

Module General
    Sub Main()
    End Sub
End Module

xTalk

Interpreter: HyperCard

on startup
  
end startup

eSQL

CREATE COMPUTE MODULE ESQL_Compute
 CREATE FUNCTION Main() RETURNS BOOLEAN
 BEGIN
   RETURN TRUE;
 END;
END MODULE;

Markup Languages

LaTeX

Compiler: pdfeTeXk, Version 3.141592-1.30.4-2.2 (Web2C 7.5.5), LaTeX2e (2003/12/01)

\documentclass{article}
\begin{document}
\end{document}