Google
 
   
Login
Username:

Password:


Lost Password?

Register now!
Search
Main Menu
top books
Polls
What do you think about php-deluxe.net?
Excellent!
Cool
Hmm..not bad
What the hell is this?
encyclopedia
recommendation
compare webbrowser
Freenet DSL
Who's Online
6 user(s) are online (5 user(s) are browsing encyclopedia)

Members: 0
Guests: 6

more...
browser tip
Unix Befehle
manual of unix befehle
recommendation!
Sponsored
partner

Off-side rule

: This article is about the off-side rule in programming. For other meanings, see Offside. A computer programming language is said to adhere to the off-side rule if in it the scope of declarations (a block) is expressed by their indentation, i.e., blocks are formed (indicated) via indentation.

=Off-side rule programming languages=

*ISWIM was the abstract language that introduced the rule *ABC programming language(), Python s parent **Python programming language *Miranda programming language, Haskell s parent **Haskell programming language *Make, in which one writes makefiles *Occam programming language *Pliant

=Definition=

Any non-whitespace token to the left of the first such token on the previous line is taken to be the start of a new declaration.

— Peter Landin, [http://www.cs.utah.edu/~wilson/compilers/old/papers/p157-landin.pdf The Next 700 Programming Languages] .

=Code examples=

...

=Alternatives=

The way popularized by C programming language is to ignore whitespace and mark blocks between curly braces { and } . An advantage of this is that program code can be automatically reformatted and neatly indented without fear of the block structure changing. A disadvantage is that a human reader of the code pays attention to identation and might miss the formal meaning that is communicated with braces.

A variation of the curly braces is the Pascal programming language convention of starting blocks with keyword begin and ending them with end . LISP doesn t differentiate statements from expressions, and parentheses are enough in it.

Another way to mark blocks is to implicitly start one after each control keyword and end it with the keyword written backwards. Thus in POSIX shell, case starts a conditional statement and it spans until the matching esac .

=External links=

*[http://wombat.doc.ic.ac.uk/foldoc/foldoc.cgioff-side+rule Off-side rule from FOLDOC]