NOTICE: Citizendium is still being set up on its newer server, treat as a beta for now; please see here for more.
Citizendium - a community developing a quality comprehensive compendium of knowledge, online and free. Click here to join and contribute—free
CZ thanks our previous donors. Donate here. Treasurer's Financial Report -- Thanks to our content contributors. --

Difference between revisions of "Syntax (computer science)"

From Citizendium
Jump to: navigation, search
m
m (Add {{subpages}} and remove any categories (details))
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
 +
{{subpages}}
 +
 
{{seealso|Syntax (disambiguation)}}
 
{{seealso|Syntax (disambiguation)}}
 
In [[computer science]], especially in the subfield of [[programming languages]], the '''syntax''' of a computer language is the set of allowed [[reserved word]]s and possible [[token_(parser)|token]] order in a [[program]]. The syntax of a [[programming language]] is the set of rules that a sequence of characters in a [[source code]] file must follow to be considered a conforming [[program]] in that language.
 
In [[computer science]], especially in the subfield of [[programming languages]], the '''syntax''' of a computer language is the set of allowed [[reserved word]]s and possible [[token_(parser)|token]] order in a [[program]]. The syntax of a [[programming language]] is the set of rules that a sequence of characters in a [[source code]] file must follow to be considered a conforming [[program]] in that language.
Line 11: Line 13:
 
==See Also==
 
==See Also==
 
* [[Computer science]]
 
* [[Computer science]]
 
[[Category:Computers Workgroup]]
 
[[Category:Mathematics Workgroup]]
 
[[Category:CZ Live]]
 

Latest revision as of 05:21, 15 November 2007

This article is basically copied from an external source and has not been approved.
Main Article
Talk
Related Articles  [?]
Bibliography  [?]
External Links  [?]
Citable Version  [?]
 
This editable Main Article is under development and not meant to be cited; by editing it you can help to improve it towards a future approved, citable version. These unapproved articles are subject to a disclaimer.
The content on this page originated on Wikipedia and is yet to be significantly improved. Contributors are invited to replace and add material to make this an original article.
See also: Syntax (disambiguation)

In computer science, especially in the subfield of programming languages, the syntax of a computer language is the set of allowed reserved words and possible token order in a program. The syntax of a programming language is the set of rules that a sequence of characters in a source code file must follow to be considered a conforming program in that language.

The rules specify how the character sequences are to be chunked into tokens (the lexical grammar), the permissible sequences of these tokens and some of the meaning to be attributed to these permissible token sequences (additional meaning is assigned by the semantics of the language).

The syntactic analysis of source code usually entails the transformation of the linear sequence of tokens into a hierarchical syntax tree (abstract syntax trees are one convenient form of syntax tree). This process is called parsing, as it is in syntactic analysis in linguistics. Tools have been written that automatically generate parsers from a specification of a language grammar written in Backus-Naur form, e.g., Yacc (yet another compiler compiler).

The syntax of computer languages is often at level-2 (ie, a context-free grammar) in the Chomsky hierarchy. As such the possible ordering of tokens is usually very restricted. The analysis of a program's syntax is usually performed using an automatically generated program known as a parser which often builds an abstract syntax tree.


See Also