22.01.2015 Views

Military Communications and Information Technology: A Trusted ...

Military Communications and Information Technology: A Trusted ...

Military Communications and Information Technology: A Trusted ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 3: <strong>Information</strong> <strong>Technology</strong> for Interoperability <strong>and</strong> Decision...<br />

213<br />

guage, a good starting point is to create a domain model of the language [2], [16].<br />

The grammar expressing concrete syntax should come out of the one describing<br />

abstract syntax <strong>and</strong> should mainly populate it with concrete lexical elements <strong>and</strong><br />

specifics of the concrete language representation. Lexical elements (i.e. terminal<br />

symbols of the CFG) are usually simple enough to be described by means of regular<br />

expressions <strong>and</strong> recognized by finite-state automata [13], [15]. The grammar<br />

describing the concrete syntax is directly used by the parser. Therefore, when designing<br />

concrete syntax of a particular CL, it is necessary to cope with the following<br />

challenges at the same time:<br />

• The concrete syntax should be based on natural language constructions<br />

commonly used in the particular context in the problem domain; otherwise<br />

there would be a high risk that the users would refuse to use the DSL.<br />

For that reason, the knowledge of the problem domain is very important.<br />

• In order to be parseable, the CFG should be a deterministic context-free<br />

grammar of a type corresponding to the particular type of parser used (most<br />

often, LL(1) or LALR(1)). This requirement is connected with the unambiguousness<br />

of the language generated by the CFG (although there are<br />

parsing techniques that are able to cope with “controlled ambiguousness”<br />

of the language being processed [13]) as well as the computational complexity<br />

of the process of parsing: an arbitrary context-free language can be<br />

parsed in O(n 3 ) time [15], but in the case of above mentioned deterministic<br />

context-free grammars this time-complexity can be reduced to O(n), where<br />

n represents the length of the language sentence being parsed.<br />

Generally, there are two main strategies of parsing CLs – top-down, where<br />

the parse tree of the given input is constructed from the root towards the leaves<br />

<strong>and</strong> bottom-up, where the parse tree is constructed in the opposite direction<br />

[2], [13], [17]. A typical type of top-down parser is a LL(1) parser, which<br />

is supported by the ANTLR (ANother Tool for Language Recognition) or JavaCC<br />

parser generators. Most commonly-used bottom-up parsers are LALR(1) parsers,<br />

which are supported by Yacc/Bison parser generators. In general, bottom-up parsing<br />

techniques are more powerful than the top-down ones in the sense of the class<br />

of recognized languages [13].<br />

For the reason of semantic processing we can populate the right-h<strong>and</strong> sides<br />

of the productions (2) with semantic action symbols. Semantic action symbols play<br />

an important role in the CL subsystem architecture (Fig. 2). The parser component<br />

(e.g. of LALR(1) type) is the central controlling unit of the whole CL subsystem.<br />

It uses the lexical analyzer to recognize lexical elements from the input. When<br />

the parser comes across a semantic action symbol (while processing a particular<br />

production or its part), it calls the corresponding semantic routine. Mutual communication<br />

among semantic routines can be implemented by means of a semantic<br />

stack maintained by the parser. Concrete techniques for implementing a semantic<br />

stack depend on the type of parser [13].

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!