General Information
Tutorials
Reference Manuals
Libraries
Translation Tasks
Tools
Administration
|
Name analysis according to scope rulesJoined Ranges
In some situations it is not possible to specify the tree grammar
such that each range in the sense of scope rules is rooted
by one single grammar symbol as required for using the role
Using one of these modules requires that the corresponding
basic scope rule module is instantiated with the same generic parameters
This module implements the following concept: Several ranges in the program form one single range in the sense of scope rules, i.e. the definition in these ranges contribute to a single scope in which the applied identifier occurrences of these ranges are bound. There is a symbol which is the subtree root for all these ranges. But it is not a range in the sense of scope rules because it may also contain identifier occurrences that are bound in the enclosing range.
The modules provide
We demonstrate the use of these facilities by extending the language of our running example by introducing an artificial language construct: It consists of a defining identifier occurrence, that is to be bound in the enclosing range, and two compound statements which form one single range in the sense of scope rules:
Statement: Join. Join: 'join' DefIdent JoinedBlock JoinedBlock 'joined' ';'. JoinedBlock: Compound.
Hence the
RULE: Join ::= 'join' DefIdent JoinedBlock JoinedBlock 'joined' ';' END; SYMBOL Join INHERITS RangeSequence END; SYMBOL JoinedBlock INHERITS RangeElement END;
This example is applicable with either the
In case of bottom-up computations
using the Joined Ranges Algol-likeThis module implements joined ranges for Algol-like scope rules as described in (see Joined Ranges). The module is instantiated by $/Name/AlgRangeSeq.gnrc+instance=NAME +referto=KEY :inst
Using this module requires that the module
The module provides the computational roles
Joined Ranges C-likeThis module implements joined ranges for C-like scope rules as described in (see Joined Ranges). The module is instantiated by $/Name/CRangeSeq.gnrc+instance=NAME +referto=KEY :inst
Using this module requires that the module
The module provides the computational roles
Joined Ranges C-like Bottom-up
This module implements joined ranges for C-like scope rules
as described in (see Joined Ranges).
Its computations are executed The module is instantiated by $/Name/BuRangeSeq.gnrc+instance=NAME +referto=KEY :inst
Using this module requires that the module
The module provides the computational roles
A nested The example given in See Joined Ranges is here modified for the bottom-up case. We demonstrate the use of these facilities by extending the language of our running example by introducing an artificial language construct: It consists of a defining identifier occurrence, that is to be bound in the enclosing range, and two compound statements which form one single range in the sense of scope rules.
We introduce two new symbols
Statement: Join. Join: 'join' BuJoin DefIdent BuJoinEl Block BuJoinEl Block 'joined' ';'. BuJoin: . BuJoinEl: . The module roles are inherited as described above:
RULE: Join ::= 'join' BuJoin DefIdent BuJoinEl Block BuJoinEl Block 'joined' ';' END; SYMBOL Join INHERITS RangeSequence END; SYMBOL BuJoin INHERITS OpenSeqScope END; SYMBOL BuJoinEl INHERITS OpenElemScope END; SYMBOL Block INHERITS RangeScope END; |