Content deleted Content added
fix template date |
No edit summary Tags: Reverted Visual edit Mobile edit Mobile web edit |
||
Line 44:
After verifying correctness, the AST serves as the base for code generation. The AST is often used to generate an intermediate representation (IR), sometimes called an [[intermediate language]], for the code generation.
In [[computer science]], the '''abstract syntax''' of data is its structure described as a [[data type]] (possibly, but not necessarily, an [[abstract data type]]), independent of any particular representation or encoding. This is particularly used in the representation of text in [[Computer language|computer languages]], which are generally stored in a tree structure as an [[abstract syntax tree]]. Abstract syntax, which only consists of the structure of data, is contrasted with [[concrete syntax]], which also includes information about the representation. For example, concrete syntax includes features like parentheses (for grouping) or commas (for lists) which are not included in the abstract syntax, as they are implicit in the structure.
Abstract syntaxes are classified as '''first-order abstract syntax''' (FOAS), if the structure is abstract but names (identifiers) are still concrete (and thus requires [[Name resolution (programming languages)|name resolution]]), and ''[[higher-order abstract syntax]],'' if the names themselves are abstract.
== UsesEdit ==
To be implemented either for computation or communications, a mapping from the abstract syntax to specific machine representations and encodings must be defined; these may be called the "[[concrete syntax]]" (in language implementation) or the "transfer syntax" (in communications).
A [[compiler]]'s internal representation of a program will typically be specified by an abstract syntax in terms of categories such as "statement", "expression" and "identifier". This is independent of the source syntax ('''concrete syntax''') of the language being compiled (though it will often be very similar). A [[parse tree]] is similar to an [[abstract syntax tree]] but it will typically also contain features such as parentheses which are syntactically significant but which are implicit in the structure of the abstract syntax tree.
[[Algebraic data type|Algebraic data types]] are particularly well-suited to the implementation of abstract syntax.
== See also ==
== See also ==
|