
In
computing
Computing is any goal-oriented activity requiring, benefiting from, or creating computing machinery. It includes the study and experimentation of algorithmic processes, and development of both hardware and software. Computing has scientific, ...
, an unparser is a system that constructs a set of characters or image components from a given
parse tree
A parse tree or parsing tree or derivation tree or concrete syntax tree is an ordered, rooted tree that represents the syntactic structure of a string according to some context-free grammar. The term ''parse tree'' itself is used primarily in comp ...
.
[''Software Science and Engineering'' edited by Ikuo Nakata 1991 page 168]
An unparser is in effect the reverse of a traditional
parser
Parsing, syntax analysis, or syntactic analysis is the process of analyzing a string of symbols, either in natural language, computer languages or data structures, conforming to the rules of a formal grammar. The term ''parsing'' comes from Lati ...
that takes a set of string of characters and produces a parse tree. Unparsing generally involves the application of a specific set of rules to the parse tree as a "
tree walk
In computer science, tree traversal (also known as tree search and walking the tree) is a form of graph traversal and refers to the process of visiting (e.g. retrieving, updating, or deleting) each node in a tree data structure, exactly once ...
" takes place.
Given that the tree may involve both textual and graphic elements, the unparser may have two separate modules, each of which handles the relevant components.
[''Handbook of Graph Grammars and Computing by Graph Transformation: Applications, Languages and Tools'' by H. Ehrig, G. Engels 1999 pages 231-232] In such cases the "master unparser" looks up the "master unparse table" to determine if a given nested structure should be handled by one module, or the other.
See also
*
Bidirectional transformation
In computer programming, bidirectional transformations (bx) are programs in which a single piece of code can be run in several ways, such that the same data are sometimes considered as input, and sometimes as output. For example, a bx run in the f ...
*
Formal grammar
In formal language theory, a grammar (when the context is not given, often called a formal grammar for clarity) describes how to form strings from a language's alphabet that are valid according to the language's syntax. A grammar does not describe ...
*
Natural language generation
Natural language generation (NLG) is a software process that produces natural language output. In one of the most widely-cited survey of NLG methods, NLG is characterized as "the subfield of artificial intelligence and computational linguistics tha ...
References
Syntax
Compiler construction
{{Computing-stub