ENCYCLOPEDIA 4U .com



Encyclopedia Home Page

Google
  Web Encyclopedia4u.com

 

Syntactic sugar

"Syntactic sugar" is a term coined by Peter J. Landin for additions to the syntax of a language that do not affect its expressiveness but make it "sweeter" for humans to use. Syntactic sugar gives the programmer an alternative way of coding that is more succinct or more like some familiar notation. It does not affect the expressiveness of the formalism (compare chrome).

Syntactic sugar can be easily translated ("desugared") to produce a program in some simpler "core" syntax. E.g. C's a[i] notation is syntactic sugar for *(a + i). In a (curried) functional language, all operators are really functions and the use of infix notation x+y is syntactic sugar for function application (+) x y.

Alan Perlis once quipped, "Syntactic sugar causes cancer of the semicolon."

Compare candygrammar, syntactic salt.


Based on material imported from FOLDOC




Content on this web site is provided for informational purposes only. We accept no responsibility for any loss, injury or inconvenience sustained by any person resulting from information published on this site. We encourage you to verify any critical information with the relevant authorities.



Copyright © 2005 Par Web Solutions All Rights reserved.
| Privacy

This article is licensed under the GNU Free Documentation License. It uses material from the Wikipedia article "Syntactic sugar".