Information Technology Reference
In-Depth Information
or scanner. The input characters stream is split into meaningful symbols defined
by a grammar. They define the set of possible character sequences used to form
individual tokens. The term token, in the present context, refers to an abstraction
for the smallest unit of VHDL code that is convenient when describing the syntax
of the VHDL language. A token is a string of characters, categorized according
to the rules as a symbol (e.g. identifier, number, comma, etc.). Starting from
this time on, the interpreted data may be loaded into data structures for general
use: in ToPoliNano data is used to build an internal representation of the circuit
by means of a graph.
3.2 Syntactic Analysis
Syntactic analysis has the objective to determine the structure of the input
stream and to build the data structure. Token are fed to the syntactic analyzer
and, as output, in case of a tree-based data structure, one would get a node for
each element. Basic elements are represented by leaf nodes, and other elements
by composite nodes. This stage basically checks that the tokens form an allowed
expression.
3.3 The Parse Tree
Accordingto[ 40 ], a parse tree is an ordered and rooted tree that represents the
syntactic structure of a string, text file, source code written in a given program-
ming language according to some formal grammar. A parse tree for a source
code is called Abstract Syntax Tree (AST). The syntax is 'abstract' in the sense
that it does not represent every detail that appears in the real syntax.
3.4 Parsing Expression Grammar Definition
Parsing Expression Grammars (PEGs) are formal grammars that allow to
describe a formal language in terms of a set of rules for recognizing tokens.
The grammar encapsulates a set of rules, primitive parsers and sub-grammars.
After being defined, rules can be used as parser components in more complex
expressions in order to form a grammar. Grammar is basically a container for
one or more rules allowing to encapsulate more complex parsers. A grammar has
the same template arguments as a rule.
When the Parsing Expression Grammar to be defined is complex and nested,
as in ToPoliNano, where we must define a PEG for VHDL93 language specifica-
tions, it may be useful to build user-defined parser components. The grammar for
VHDL structural descriptions can be built starting from the grammar definition
of the unique constructs, i.e. constructs that do not include any other.
3.5 VHDL Grammar
A VHDL file for structural description includes an Entity Declaration and an
Architecture Body (in what follows, the libraries included at the begin of every
VHDL file are not considered):
Search WWH ::




Custom Search