World Library  
Flag as Inappropriate
Email this Article

Metasyntactic variable

Article Id: WHEBN0000020036
Reproduction Date:

Title: Metasyntactic variable  
Author: World Heritage Encyclopedia
Language: English
Subject: Foobar, Fnord, Syntax (logic), Widget (economics), Temporary variable
Collection: Metalogic, Placeholder Names, Syntax (Logic), Variable (Computer Science)
Publisher: World Heritage Encyclopedia

Metasyntactic variable

A metasyntactic variable is a placeholder name used in computer science, a word without meaning intended to be substituted by some objects pertaining to the context where it is used. The word foo as used in IETF Requests for Comments is a good example.[1]

By mathematical analogy, a metasyntactic variable is a word that is a variable for other words, just as in algebra letters are used as variables for numbers.[1] Any symbol or word which does not violate the syntactic rules of the language can be used as a metasyntactic variable. For specifications written in natural language, nonsense words are commonly used as metasyntactic variables.

Metasyntactic variables have a secondary, implied meaning to the reader (often students), which makes them different from normal metavariables. It is understood by those who have studied computer science that certain words are placeholders or examples only and should or must be replaced in a production-level computer program.

In hacker culture, "metasyntactic variable" has come to denote some typical (otherwise meaningless) words used as metavariables in computing; see reification. For example, The Hacker's Dictionary (1st ed.) defined FOO as "the first metasyntactic variable" and BAR as "the second metasyntactic variable", explaining that "When you have to invent an arbitrary temporary name for something for the sake of exposition, FOO is usually used. If you need a second one, BAR or BAZ is usually used; there is a slight preference at MIT for bar and at Stanford for baz. Clearly, bar was the original, for the concatenation FOOBAR is widely used also, and this in turn can be traced to the obscene acronym 'FUBAR' that arose in the armed forces during World War II. [...] A hacker avoids using 'foo' as the real name of anything. Indeed, a standard convention is that any file with 'foo' in its name is temporary and can be deleted on sight."[2] The names of these consecrated "metasyntactic variables" are also commonly used as actual identifiers (for variables, functions, etc.) in tutorial programming examples when their purpose is to emphasize syntax; in this usage, "metasyntactic variable" is synonymous with "meaningless word".[3]


  • Construction 1
  • Examples 2
  • Words commonly used as metasyntactic variables 3
    • Arabic 3.1
    • English 3.2
    • German 3.3
    • French 3.4
    • Hebrew 3.5
    • Italian 3.6
    • Japanese 3.7
    • Portuguese 3.8
    • Spanish 3.9
    • Turkish 3.10
    • Persian 3.11
  • See also 4
  • References 5
  • External links 6


  • meta- means providing information about, or transcending,
  • syntax denotes the grammatical arrangement of words or the grammatical rules of a programming language, and
  • a variable is something that can assume a value, or something likely to vary.

So metasyntactic variable denotes a word that "transcends grammar and can assume a value" or one that is "more comprehensive than suggested by its grammatical arrangement and is likely to vary". It may also denote a word that provides information about the grammatical arrangement of words by being able to assume a value that is expected to vary.


RFC 772 (cited in RFC 3092) contains for instance:

 All is well; now the recipients can be specified.

     S: MRCP TO: 
     R: 200 OK

     S: MRCP TO: 
     R: 553  No such user here

     S: MRCP TO: 
     R: 200 OK

     S: MRCP TO:<@Y,@X,fubar@Z> 
     R: 200 OK

  Note that the failure of "Raboof" has no effect on the storage of
  mail for "Foo", "bar" or the mail to be forwarded to "fubar@Z"
  through host "X".

Both the IETF RFCs and computer programming languages are rendered in plain text, making it necessary to distinguish metasyntactic variables by a naming convention, more or less obvious from context. If rich text formatting is available, e.g. as in the HTML produced from texinfo sources, then a typographical convention may be used, as done for the example in the GNU Fortran manual:[4]

A metasyntactic variable—that is, a name used in this document to serve as a placeholder for whatever text is used by the user or programmer—appears as shown in the following example: “The INTEGER ivar statement specifies that ivar is a variable or array of type INTEGER.” In the above example, any valid text may be substituted for the metasyntactic variable ivar to make the statement apply to a specific instance, as long as the same text is substituted for both occurrences of ivar.

The above example uses italics to denote metavariables (borrowing from the common convention to use italics for variables in mathematics), although italics are also used in the same text for emphasizing other words. (The documentation for texinfo emphasizes the distinction between metavariables and mere variables used in a programming language being documented in some texinfo file as: "Use the @var command to indicate metasyntactic variables. A metasyntactic variable is something that stands for another piece of text. For example, you should use a metasyntactic variable in the documentation of a function to describe the arguments that are passed to that function. Do not use @var for the names of particular variables in programming languages. These are specific names from a program, so @code is correct for them."[5]) Another point reflected in the above example is the convention that a metavariable is to be uniformly substituted with the same instance in all its appearances in a given schema. This is in contrast with nonterminal symbols in formal grammars where the nonterminals on the right of a production can be substituted by different instances.[6]

A third example of the use of the "metasyntactic variables" foo and bar, this time as actual identifiers in a programming (interview) example is contrasting the following C++ function prototypes for their different argument passing mechanisms:[7]

void foo(Fruit bar);
void foo(Fruit* bar);
void foo(Fruit& bar);

Words commonly used as metasyntactic variables


In Arabic, the word "kedha" (كذا) is often used in the same way English speakers use the word "bla" as in, "kedha, kedha, kedha" to mean "this, that, and the other thing" or, "such and such". Similarly, the names "Fullan" (فلان) and "'Allan" (علان) are used to refer to non-specific persons, a practice which has been adopted in other languages (see Portuguese, Spanish, Turkish and Persian below). أما بعد


A "standard list of metasyntactic variables used in syntax examples" often used in the United States is: plugh, xyzzy, thud.[1] The word foo occurs in over 330 RFCs and bar occurs in over 290.[8] Wibble, wobble, wubble, Fred and flob are often used in the UK.[9]

Due to English being the foundation-language, or lingua franca, of most computer programming languages these variables are also commonly seen even in programs and examples of programs written for other spoken-language audiences.

The typical names may depend however on the subculture that has developed around a given programming language. For example, spam, ham, and eggs are the principal metasyntactic variables used in the Python programming language.[10] This is a reference to the famous comedy sketch Spam by Monty Python, the eponym of the language.[11]

The R programming language often adds norf to the list.[12][13]


In German, the words bla, blubb and blabla are commonly used as names for metasyntactic variables (comparable with English blah, blah-blah).


In French, the words toto, titi, tata, tutu, truc, bidule, machin and azerty are commonly used (AZERTY being the order of first letters on French keyboards).


In Hebrew, the words chupchick and stam are commonly used.


In Italian, the word pippo is commonly used. Strangely enough, besides being a diminutive of the first names Giuseppe (Joseph) and Filippo (Philip), pippo is the Italian name of the Disney character Goofy, but it is probably used just because of its sound which is quite strange; moreover, this name can be typed very quickly on a computer keyboard, as it involves three near keys (P, I and O). Sometimes the words pluto and paperino (Italian name of Donald Duck) can be hence used as additional terms.


In Japanese, the words hoge and piyo are commonly used, with other common words and variants being fuga, hogera, and hogehoge.[14] Note that -ra is a pluralizing ending in Japanese, and reduplication is also used for pluralizing. The origin of hoge as a metasyntactic variable is not known, but it is believed to date to the early 1980s.[14]


In Portuguese, the words fulano, sicrano and beltrano are commonly used to refer to people . To refer to objects in general, the most common placeholder name is XPTO.


In Spanish, the words fulano, mengano and zutano are commonly used, often followed by de tal mocking a lastname in Spanish form (e.g. Fulano de Tal). These words have the constraint that they can only be used to refer to people, as in the case with Portuguese. Also, when referring to an example of some person performing a certain action, Perico de los Palotes can also be used as a placeholder for a real name. In place of people or objects (including numbers, etc.) the usual X, Y, Z are used (e.g. Person X, Quantity Z).


In Turkish, the words falan, filan, hede, hödö, hebele, hübele are commonly used.


In Persian, the word folân is used for Foo and the words bahmān and bisār used for Bar.

See also


  1. ^ a b c RFC 3092 (rfc3092) - Etymology of "Foo"
  2. ^ As reproduced in Hank Bromley; Richard Lamson (1987). Lisp lore: a guide to programming the Lisp machine. Kluwer Academic. p. 291. 
  3. ^ Mark Slagell (2002). Sams Teach Yourself Ruby in 21 Days. Sams Publishing. p. 108.  
  4. ^
  5. ^
  6. ^ R. D. Tennent (2002). Specifying Software: A Hands-On Introduction. Cambridge University Press. pp. 36–37 and 210.  
  7. ^ John Mongan; Noah Kindler; Eric Giguere (2012). Programming Interviews Exposed: Secrets to Landing Your Next Job. John Wiley & Sons. p. 242.  
  8. ^
  9. ^ wibble. (n.d.). Jargon File 4.4.7. Retrieved February 23, 2010, from [1]
  10. ^ Python Tutorial
  11. ^ General Python FAQ
  12. ^
  13. ^
  14. ^ a b メタ構文変数 (Japanese)

External links

  • , with examples.metasyntactic variableDefinition of
  • Examples of metasyntactic variables used in Commonwealth Hackish, such as wombat.
  • Variable "foo" and Other Programming Oddities
This article was sourced from Creative Commons Attribution-ShareAlike License; additional terms may apply. World Heritage Encyclopedia content is assembled from numerous content providers, Open Access Publishing, and in compliance with The Fair Access to Science and Technology Research Act (FASTR), Wikimedia Foundation, Inc., Public Library of Science, The Encyclopedia of Life, Open Book Publishers (OBP), PubMed, U.S. National Library of Medicine, National Center for Biotechnology Information, U.S. National Library of Medicine, National Institutes of Health (NIH), U.S. Department of Health & Human Services, and, which sources content from all federal, state, local, tribal, and territorial government publication portals (.gov, .mil, .edu). Funding for and content contributors is made possible from the U.S. Congress, E-Government Act of 2002.
Crowd sourced content that is contributed to World Heritage Encyclopedia is peer reviewed and edited by our editorial staff to ensure quality scholarly research articles.
By using this site, you agree to the Terms of Use and Privacy Policy. World Heritage Encyclopedia™ is a registered trademark of the World Public Library Association, a non-profit organization.

Copyright © World Library Foundation. All rights reserved. eBooks from Project Gutenberg are sponsored by the World Library Foundation,
a 501c(4) Member's Support Non-Profit Organization, and is NOT affiliated with any governmental agency or department.