Hello World (PIR)

From LiteratePrograms

Jump to: navigation, search
Other implementations: Ada | ALGOL 68 | Alice ML | Amiga E | Applescript | AspectJ | Assembly Intel x86 Linux | Assembly Intel x86 NetBSD | AWK | bash | BASIC | Batch files | C | C, Cairo | C, Xlib | Candle | Clojure | C++ | C# | Delphi | Dylan | E | Eiffel | Erlang | Forth | FORTRAN | Fortress | Go | Groovy | Haskell | Hume | IBM PC bootstrap | Inform 7 | Java | Java, Swing | JavaScript | LaTeX | Lisp | Logo | Lua | Maple | MATLAB | Mercury | OCaml/F Sharp | occam | Oz | Pascal | Perl | PHP | Pic | PIR | PLI | PostScript | Prolog | Python | Rexx | Ruby | Scala | Scheme | Seed7 | sh | Smalltalk | SQL | Standard ML | SVG | Tcl | Tcl Tk | Visual Basic | Visual Basic .NET | XSL

In this article, we describe the "Hello World" program in the Parrot intermediate representation (PIR).

Creating a sub-routine in PIR is simple, just write .sub name. The :main tag indicates that this is the entry point for the program. There can be maximum one of these. If no :main tag is provided, Parrot will start on the first routine.

Parrot has built-in support for writing, which makes this "Hello World" program much simpler than in other assembly languages. The print instruction takes any value as argument, and prints it on stdout.

<<hello.pir>>=
.sub main :main
	print "Hello, World!\n"
.end
Download code
Views
Personal tools