#|| VHDL Object Model 1.0 --------------------- Copyright (c) 1994 Ohio Board of Regents and the University of Cincinnati. All rights reserved. Authors: David Benz, Phillip Baraona E-Mail: dbenz@thor.ece.uc.edu, pbaraona@thor.ece.uc.edu ||# #|| File: grammar.re Contains: Grammar productions for VHDL object model. Organization: Mirrors the object-class definitions in class-defns.re. That is, from top to bottom of this file, we move from the most general to the most specific objects. ||# !! in-package("VOM-1-0") !! in-grammar('syntax) grammar VHDL-93 start-classes vhdl-design-file file-classes vhdl-design-file no-patterns local-pseudoterminals *bit-string-literal* productions %% Design Files (Sec. 11.1) vhdl-design-file ::= [ design-unit-list +";" ";" ] builds vhdl-design-file, %% Design Units (Sec. 11.1) design-unit %% design unit (11.1) ::= [ { [ context-item-list +";" ";" ] } library-unit-map ] builds design-unit, %% Context Items (Sec. 11.3) library-clause %% library clause (11.2) ::= [ "library" identifier-list +"," ] builds library-clause, context-item ::= [ use-clause ] semantics lambda(x) x, %% Design Entities, Configurations and Packages (Chaps. 1 & 2) entity-declaration %% entity declaration (1.1) ::= [ "entity" identifier-map "is" { [ generic-clause-map ";" ] } { [ port-clause-map ";" ] } { [ declaration-list +";" ";" ] } { [ "begin" { [ concurrent-statement-list +";" ";" ] } ] } "end" { [ "entity" ] } { [ end-name ] } ] builds entity-declaration, architecture-body %% architecture body (1.2) ::= [ "architecture" identifier-map "of" entity-name "is" { [ declaration-list +";" ";" ] } "begin" { [ concurrent-statement-list +";" ";" ] } "end" { [ "architecture" ] } { [ end-name ] } ] builds architecture-body, configuration-declaration %% configuration declaration (1.3) ::= [ "configuration" identifier-map "of" entity-name "is" { [ configuration-declarative-item-list +";" ";" ] } block-configuration-map ";" "end" { [ "configuration" ] } { [ end-name ] } ] builds configuration-declaration, package-declaration %% package declaration (2.5) ::= [ "package" identifier-map "is" { [ declaration-list +";" ";" ] } "end" { [ "package" ] } { [ end-name ] } ] builds package-declaration, package-body %% package body (2.6) ::= [ "package" "body" package-simple-name "is" { [ declaration-list +";" ";" ] } "end" { [ "package" "body" ] } { [ end-name ] } ] builds package-body, %% Configuration Items (Secs. 1.3.1, 1.3.2) block-configuration %% block configuration (1.3.1) ::= [ "for" block-specification { [ use-clause-list +";" ";" ] } { [ configuration-item-list +";" ";" ] } "end" "for" ] builds block-configuration, component-configuration %% component configuration (1.3.2) ::= [ "for" component-specification-map { [ { [ "use" entity-aspect-map ] } { [ generic-map-aspect-map ] } { [ port-map-aspect-map ] } ";" ] } { [ block-configuration-map ";" ] } "end" "for" ] builds component-configuration, %% Concurrent Statements (Chap. 9) labeled-concurrent-stmt ::= [ concurrent-stmt-label ":" unlabeled-concurrent-stmt-map ] builds labeled-concurrent-stmt, block-statement %% block statement (9.1) ::= [ "block" { [ guard-expression ] } { [ "is" ] } { [ generic-clause-map ";" { [ generic-map-aspect-map ";" ] } ] } { [ port-clause-map ";" { [ port-map-aspect-map ";" ] } ] } { [ declaration-list +";" ";" ] } "begin" { [ concurrent-statement-list +";" ";" ] } "end" "block" { [ end-name ] } ] builds block-statement, process-statement %% process statement (9.2) ::= [ "process" { [ "postponed" !! process-postponed-flag ] } { [ "(" sensitivity-list +"," ")" ] } { [ "is" ] } { [ declaration-list +";" ";" ] } "begin" { [ sequential-statement-list +";" ";" ] } "end" { [ "postponed" !! second-postponed-flag ] } "process" { [ end-name ] } ] builds process-statement, postponed-concurrent-stmt ::= [ "postponed" unpostponed-concurrent-stmt-map ] builds postponed-concurrent-stmt, concurrent-procedure-call %% concurrent procedure call (9.3) ::= [ procedure-call-map ] builds concurrent-procedure-call, concurrent-assertion-stmt %% concurrent assertion ::= [ assertion-statement-map ] %% statement (9.4) builds concurrent-assertion-stmt, conditional-signal-assign %% conditional signal ::= [ target-map "<=" { [ "guarded" ] } %% assignment (9.5.1) { [ delay-mechanism-map ] } conditional-waveform-list +"else" ] builds conditional-signal-assign, conditional-waveform ::= [ ( "unaffected" | waveform-element-list +"," ) { [ "when" test-condition ] } ] builds conditional-waveform, selected-signal-assign %% selected signal ::= [ "with" expression-value "select" %% assignment (9.5.2) target-map "<=" { [ "guarded" ] } { [ delay-mechanism-map ] } selected-waveform-list +"," ] builds selected-signal-assign, selected-waveform ::= [ ( "unaffected" | waveform-element-list +"," ) "when" choice-list +"|" ] builds selected-waveform, component-instantiation %% component instantiation ::= [ instantiation-label ":" %% statement (9.6) instantiated-unit-map { [ generic-map-aspect-map ] } { [ port-map-aspect-map ] } ] builds component-instantiation, %% The extra component instantiation constructs are needed to %% differentiate between a concurrent-procedure-call. component-instantiation ::= [ identifier ":" vhdl-name generic-map-aspect ] semantics (lambda (id-1, t1, name-1, gen-map-1) parser-set-attrs( make-object('component-instantiation), 'instantiation-label, id-1, 'simple-instantiated-unit, name-1, 'generic-map-aspect-map, gen-map-1)), component-instantiation ::= [ instantiation-label ":" simple-instantiated-unit generic-map-aspect-map ] print-only, component-instantiation ::= [ identifier ":" vhdl-name port-map-aspect ] semantics (lambda (id-1, t1, name-1, port-map-1) parser-set-attrs( make-object('component-instantiation), 'instantiation-label, id-1, 'simple-instantiated-unit, name-1, 'port-map-aspect-map, port-map-1)), component-instantiation ::= [ instantiation-label ":" simple-instantiated-unit port-map-aspect-map ] print-only, component-instantiation ::= [ identifier ":" vhdl-name generic-map-aspect port-map-aspect ] semantics (lambda (id-1, t1, name-1, gen-map-1, port-map-1) parser-set-attrs( make-object('component-instantiation), 'instantiation-label, id-1, 'simple-instantiated-unit, name-1, 'generic-map-aspect-map, gen-map-1, 'port-map-aspect-map, port-map-1)), component-instantiation ::= [ instantiation-label ":" simple-instantiated-unit generic-map-aspect-map port-map-aspect-map ] print-only, component-unit-name ::= [ "component" instantiated-unit-name ] builds component-unit-name, entity-unit-name ::= [ "entity" instantiated-unit-name ] builds entity-unit-name, configuration-unit-name ::= [ "configuration" instantiated-unit-name ] builds configuration-unit-name, generate-statement %% generate statement (9.7) ::= [ generate-label ":" generation-scheme-map "generate" { [ declaration-list +";" ";" "begin" ] } { [ concurrent-statement-list +";" ";" ] } "end" "generate" { [ end-name ] } ] builds generate-statement, if-generation-scheme ::= [ "if" test-condition ] builds if-generation-scheme, for-generation-scheme ::= [ "for" identifier-map "in" discrete-range-map ] builds for-generation-scheme, %% Sequential Statements (Chap. 8) labeled-sequential-stmt ::= [ sequential-stmt-label ":" unlabeled-sequential-stmt-map ] builds labeled-sequential-stmt, wait-statement %% wait statement (8.1) ::= [ "wait" { [ "on" sensitivity-list +"," ] } { [ "until" test-condition ] } { [ "for" timeout-clause ] } ] builds wait-statement, assertion-statement %% assertion statement (8.2) ::= [ "assert" test-condition { [ "report" report-expression ] } { [ "severity" severity-expression ] } ] builds assertion-statement, report-statement %% report statement (8.3) ::= [ "report" report-expression { [ "severity" severity-expression ] } ] builds report-statement, signal-assignment %% signal assignment (8.4) ::= [ target-map "<=" { [ delay-mechanism-map ] } ( [ "unaffected" ] | [ waveform-element-list +"," ] ) ] builds signal-assignment, transport-delay-mechanism ::= [ "transport" ] builds transport-delay-mechanism, inertial-delay-mechanism ::= [ { [ "reject" pulse-rejection-limit ] } "inertial" ] builds inertial-delay-mechanism, waveform-element ::= [ expression-value { [ "after" delay-expression ] }] builds waveform-element, target ::= [ vhdl-name ] semantics lambda(x) x, target ::= [ aggregate-expression ] semantics lambda(x) x, variable-assignment %% variable assignment (8.5) ::= [ target-map ":=" expression-value ] builds variable-assignment, %% if the procedure has arguments then the procedure name will be an %% indexed-or-slice-name. procedure-call %% procedure call (8.6) ::= [ procedure-name ] builds procedure-call, if-statement %% if statement (8.7) ::= [ "if" test-condition "then" { [ sequential-statement-list +";" ";" ] } elsif-part *"" { [ "else" else-statements +";" ";" ] } "end" "if" { [ end-name ] } ] builds if-statement, elsif-object ::= [ "elsif" test-condition "then" { [ sequential-statement-list +";" ";" ] } ] builds elsif-object, case-statement %% case statement (8.8) ::= [ "case" expression-value "is" case-statement-part +"" "end" "case" { [ end-name ] } ] builds case-statement, case-alternative ::= [ "when" choice-list +"|" "=>" { [ sequential-statement-list +";" ";" ] } ] builds case-alternative, basic-loop-statement %% loop statements (8.9) ::= [ "loop" { [ sequential-statement-list +";" ";" ] } "end" "loop" { [ end-name ] } ] builds basic-loop-statement, while-loop-statement ::= [ "while" test-condition "loop" { [ sequential-statement-list +";" ";" ] } "end" "loop" { [ end-name ] } ] builds while-loop-statement, for-loop-statement ::= [ "for" identifier-map "in" discrete-range-map "loop" { [ sequential-statement-list +";" ";" ] } "end" "loop" { [ end-name ] } ] builds for-loop-statement, next-statement %% next statement (8.10) ::= [ "next" { [ identifier-map ] } { [ "when" test-condition ] } ] builds next-statement, exit-statement %% exit statement (8.11) ::= [ "exit" { [ identifier-map ] } { [ "when" test-condition ] } ] builds exit-statement, return-statement %% return statement (8.12) ::= [ "return" { [ expression-value ] } ] builds return-statement, null-statement %% null statement (8.13) ::= [ "null" ] builds null-statement, %% Declarations (Chap. 4) full-type-declaration %% full type decl (4.1) ::= [ "type" identifier-map "is" type-definition-map ] builds full-type-declaration, incomplete-type-declaration %% incomplete type (3.3.1) ::= [ "type" identifier-map ] builds incomplete-type-declaration, subtype-declaration %% subtype declaration (4.2) ::= [ "subtype" identifier-map "is" subtype-indication-map ] builds subtype-declaration, constant-declaration %% constant declaration (4.3.1.1) ::= [ "constant" identifier-list +"," ":" subtype-indication-map { [":=" expression-value] } ] builds constant-declaration, signal-declaration %% signal declaration (4.3.1.2) ::= [ "signal" identifier-list +"," ":" subtype-indication-map { [ signal-kind-map ] } { [":=" expression-value] } ] builds signal-declaration, variable-declaration %% variable declaration (4.3.1.3) ::= [ { [ "shared" ] } "variable" identifier-list +"," ":" subtype-indication-map { [":=" expression-value] } ] builds variable-declaration, file-declaration %% file declaration (4.3.1.4) ::= [ "file" identifier-list +"," ":" subtype-indication-map { [ file-open-information-map ] } ] builds file-declaration, file-open-information ::= [ { [ "open" expression-value ] } "is" file-logical-name ] builds file-open-information, alias-declaration %% alias declarations (4.3.3) ::= [ "alias" alias-designator { [ ":" subtype-indication-map ] } "is" alias-name { [ signature-map ] } ] builds alias-declaration, attribute-declaration %% attribute declarations (4.4) ::= [ "attribute" identifier-map ":" type-mark ] builds attribute-declaration, component-declaration %% component declarations (4.5) ::= [ "component" identifier-map { [ "is" ] } { [ generic-clause-map ";" ] } { [ port-clause-map ";" ] } "end" "component" { [ end-name ] } ] builds component-declaration, group-template-declaration %% group template ::= [ "group" identifier-map "is" %% declarations (4.6) "(" entity-class-entry-list +"," ")" ] builds group-template-declaration, entity-class-entry ::= [ entity-class-map { [ "<>" ] } ] builds entity-class-entry, group-declaration %% group declarations (4.7) ::= [ "group" identifier-map ":" group-template-name ] builds group-declaration, %% Scoping and Visibility use-clause %% use clause (10.4) ::= [ "use" use-selected-names-list +"," ] builds use-clause, %% Specifications (Chap. 5) attribute-specification %% attribute specification (5.1) ::= [ "attribute" attribute-designator "of" ( [ entity-name-list +"," ] | [ "others" !! decl-others-flag ] | [ "all" !! decl-all-flag ] ) ":" entity-class-map "is" expression-value ] builds attribute-specification, entity-designator ::= [ entity-tag { [ signature-map ] } ] builds entity-designator, configuration-specification %% configuration ::= [ "for" component-specification-map %% specification (5.2) { [ "use" entity-aspect-map ] } { [ generic-map-aspect-map ] } { [ port-map-aspect-map ] } ] builds configuration-specification, component-specification ::= [ ( [ instantiation-list +"," ] | [ "others" !! component-others-flag ] | [ "all" !! component-all-flag ] ) ":" component-name ] builds component-specification, disconnection-specification %% disconnection ::= [ "disconnect" ( [ signal-list +"," ] | %% specification (5.3) [ "others" !! decl-others-flag ] | [ "all" !! decl-all-flag ] ) ":" type-mark "after" expression-value ] builds disconnection-specification, procedure-declaration %% subprogram ::= [ "procedure" designator-map %% specifications (2.1) { [ "(" interface-list-map +";" ")" ] } ] builds procedure-declaration, function-declaration ::= [ "function" designator-map { [ "(" interface-list-map +";" ")" ] } "return" type-mark ] builds function-declaration, pure-function-decl ::= [ "pure" "function" designator-map { [ "(" interface-list-map +";" ")" ] } "return" type-mark ] builds pure-function-decl, impure-function-decl ::= [ "impure" "function" designator-map { [ "(" interface-list-map +";" ")" ] } "return" type-mark ] builds impure-function-decl, %% allow designator to parse as an identifier or string-literal designator ::= [ identifier ] semantics lambda(x) x, designator ::= [ string-literal ] semantics lambda(x) x, subprogram-body ::= [ subprogram-specification-map "is" { [ declaration-list +";" ";" ] } "begin" { [ sequential-statement-list +";" ";" ] } "end" { [ subprogram-kind-map ] } { [ designator-map ] } ] builds subprogram-body, procedure-kind ::= [ "procedure" ] builds procedure-kind, function-kind ::= [ "function" ] builds function-kind, %% Interface Declarations (Sec. 4.3.2) %% Constant, variable and signal interface declarations have been %% combined into interface declaration. Separate constructs were not %% unique enough to warrant distinct objects. interface-declaration ::= [ { ( "signal" | "variable" | "constant") } identifier-list +"," ":" { [ mode-map ] } subtype-indication-map { [ optional-signal-kind ] } { [ ":=" expression-value ] } ] builds interface-declaration, interface-file-decl ::= [ "file" identifier-list +"," subtype-indication-map ] builds interface-file-decl, %% Binding Indications (Sec. 5.2.1) entity-aspect %% entity aspect (5.2.1.1) ::= [ ( [ "entity" aspect-name ] | [ "configuration" aspect-name ] | [ "open" ] ) ] builds entity-aspect, generic-map-aspect %% generic map aspect (5.2.1.2) ::= [ "generic" "map" "(" association-list-map +"," ")" ] builds generic-map-aspect, port-map-aspect %% port map aspect (5.2.1.2) ::= [ "port" "map" "(" association-list-map +"," ")" ] builds port-map-aspect, %% Entity Class (Sec. 5.1) entity-keyword ::= [ "entity" ] builds entity-keyword, procedure-keyword ::= [ "procedure" ] builds procedure-keyword, type-keyword ::= [ "type" ] builds type-keyword, signal-keyword ::= [ "signal" ] builds signal-keyword, label-keyword ::= [ "label" ] builds label-keyword, group-keyword ::= [ "group" ] builds group-keyword, architecture-keyword ::= [ "architecture" ] builds architecture-keyword, function-keyword ::= [ "function" ] builds function-keyword, subtype-keyword ::= [ "subtype" ] builds subtype-keyword, variable-keyword ::= [ "variable" ] builds variable-keyword, literal-keyword ::= [ "literal" ] builds literal-keyword, file-keyword ::= [ "file" ] builds file-keyword, configuration-keyword ::= [ "configuration" ] builds configuration-keyword, package-keyword ::= [ "package" ] builds package-keyword, constant-keyword ::= [ "constant" ] builds constant-keyword, component-keyword ::= [ "component" ] builds component-keyword, units-keyword ::= [ "units" ] builds units-keyword, %% Entity Header Clauses (Sec. 1.1.1) generic-clause ::= [ "generic" "(" interface-list-map +";" ")" ] builds generic-clause, port-clause ::= [ "port" "(" interface-list-map +";" ")" ] builds port-clause, %% Signal Kind (Sec. 4.3.1.2) register-kind ::= [ "register" ] builds register-kind, bus-kind ::= [ "bus" ] builds bus-kind, %% Mode (Sec. 4.3.2) in-mode ::= [ "in" ] builds in-mode, out-mode ::= [ "out" ] builds out-mode, inout-mode ::= [ "inout" ] builds inout-mode, buffer-mode ::= [ "buffer" ] builds buffer-mode, linkage-mode ::= [ "linkage" ] builds linkage-mode, %% Types (Chap. 3) scalar-type-definition ::= [ range-constraint-map ] builds scalar-type-definition, enumeration-type-def ::= [ "(" enumeration-literal-list +"," ")" ] builds enumeration-type-def, physical-type-def %% physical type (3.1.3) ::= [ range-constraint-map "units" base-unit-declaration ";" secondary-unit-list * "" "end" "units" {end-name} ] builds physical-type-def, secondary-unit-declaration %% secondary unit (3.1.3) ::= [ secondary-unit-name "=" physical-literal-or-name-map ";" ] builds secondary-unit-declaration, physical-literal-or-name ::= [ physical-literal ] semantics lambda (x) x, physical-literal-or-name ::= [ vhdl-name ] semantics lambda (x) x, unconstrained-array-def %% unconstr. array (3.2.1) ::= [ "array" "(" index-subtype-list +"," ")" "of" subtype-indication-map ] builds unconstrained-array-def, constrained-array-def %% constr. array (3.2.1) ::= [ "array" index-constraint-map "of" subtype-indication-map ] builds constrained-array-def, index-subtype-definition %% index subtype (3.2.1) ::= [ type-mark "range" "<>" ] builds index-subtype-definition, record-type-def %% record type (3.2.2) ::= [ "record" element-list +";" ";" "end" "record" { [ end-name ] } ] builds record-type-def, element-declaration %% element decl (3.2.2) ::= [ identifier-list +"," ":" element-subtype-definition ] builds element-declaration, access-type-definition %% access type (3.3) ::= [ "access" subtype-indication-map ] builds access-type-definition, file-type-definition %% file type (3.4) ::= [ "file" "of" type-mark ] builds file-type-definition, %% Constraints %% Semantics clause used to determine when an expression ends. range-constraint %% range constraint (3.1) ::= [ "range" expression ] semantics (lambda (t1, expr-1) parser-set-attrs( make-object('range-constraint), 'left-bound, expr-1)), range-constraint ::= [ "range" left-bound ] print-only, range-constraint ::= [ "range" expression direction expression ] semantics (lambda (t1, expr-1, dir-1, expr-2) parser-set-attrs( make-object('range-constraint), 'left-bound, expr-1, 'direction-map, dir-1, 'right-bound, expr-2)), range-constraint ::= [ "range" left-bound direction-map right-bound ] print-only, to-direction ::= [ "to" ] builds to-direction, downto-direction ::= [ "downto" ] builds downto-direction, index-constraint %% index constraint (3.2.1) ::= [ "(" discrete-range-list +"," ")" ] builds index-constraint, %% Range simple-range %% range (3.1) ::= [ expression direction expression ] semantics (lambda (expr-1, dir-1, expr-2) parser-set-attrs( make-object('simple-range), 'left-bound, expr-1, 'direction-map, dir-1, 'right-bound, expr-2)), simple-range ::= [ left-bound direction-map right-bound ] print-only, %% Discrete Range discrete-range %% discrete_range (3.2.1) ::= [ expression ] semantics lambda(x) x, discrete-range ::= [ simple-subtype-indication ] semantics lambda(x) x, discrete-range ::= [ simple-range ] semantics lambda(x) x, %% Subtype Indications subtype-indication %% subtype indication (4.2) ::= [ vhdl-name ] semantics (lambda (tm-1) parser-set-attrs( make-object('subtype-indication), 'type-mark, tm-1)), subtype-indication ::= [ type-mark ] print-only, simple-subtype-indication ::= [ vhdl-name vhdl-name range-constraint ] semantics (lambda (res-func-1, tm-1, const-1) parser-set-attrs( make-object('simple-subtype-indication), 'res-func-name, res-func-1, 'type-mark, tm-1, 'subtype-constraint, const-1)), simple-subtype-indication ::= [ res-func-name type-mark subtype-constraint ] print-only, simple-subtype-indication ::= [ vhdl-name vhdl-name ] semantics (lambda (res-func-1, tm-1) parser-set-attrs( make-object('simple-subtype-indication), 'res-func-name, res-func-1, 'type-mark, tm-1)), simple-subtype-indication ::= [ res-func-name type-mark ] print-only, simple-subtype-indication ::= [ vhdl-name range-constraint ] semantics (lambda (tm-1, const-1) parser-set-attrs( make-object('simple-subtype-indication), 'type-mark, tm-1, 'subtype-constraint, const-1)), simple-subtype-indication ::= [ type-mark subtype-constraint ] print-only, %% Signatures signature %% signature (2.3.2) ::= [ "[" { [ type-mark-list +"," ] } { [ "return" type-mark ] } "]" ] builds signature, %% Expressions (Chap. 7) logical-and %% logical operators (7.2.1) ::= [ argument-1 "and" argument-2 ] builds logical-and, logical-or ::= [ argument-1 "or" argument-2 ] builds logical-or, logical-xor ::= [ argument-1 "xor" argument-2 ] builds logical-xor, logical-nand ::= [ argument-1 "nand" argument-2 ] builds logical-nand, logical-nor ::= [ argument-1 "nor" argument-2 ] builds logical-nor, logical-xnor ::= [ argument-1 "xnor" argument-2 ] builds logical-xnor, compare-equal %% relational operators (7.2.2) ::= [ argument-1 "=" argument-2 ] builds compare-equal, compare-greater ::= [ argument-1 ">" argument-2 ] builds compare-greater, compare-less ::= [ argument-1 "<" argument-2 ] builds compare-less, compare-greater-equal ::= [ argument-1 ">=" argument-2 ] builds compare-greater-equal, compare-less-equal ::= [ argument-1 "<=" argument-2 ] builds compare-less-equal, compare-not-equal ::= [ argument-1 "/=" argument-2 ] builds compare-not-equal, shift-left-logic %% shift operators (7.2.3) ::= [ argument-1 "sll" argument-2 ] builds shift-left-logic, shift-left-arith ::= [ argument-1 "sla" argument-2 ] builds shift-left-arith, shift-right-logic ::= [ argument-1 "srl" argument-2 ] builds shift-right-logic, shift-right-arith ::= [ argument-1 "sra" argument-2 ] builds shift-right-arith, rotate-left-logic ::= [ argument-1 "rol" argument-2 ] builds rotate-left-logic, rotate-right-logic ::= [ argument-1 "ror" argument-2 ] builds rotate-right-logic, add-operator-plus %% adding operators (7.2.4) ::= [ argument-1 "+" argument-2 ] builds add-operator-plus, add-operator-minus ::= [ argument-1 "-" argument-2 ] builds add-operator-minus, add-operator-and ::= [ argument-1 "&" argument-2 ] builds add-operator-and, sign-operator-plus %% sign operators (7.2.5) ::= [ "+" argument-1 ] builds sign-operator-plus, sign-operator-minus ::= [ "-" argument-1 ] builds sign-operator-minus, mult-operator-times %% multipying operators (7.2.6) ::= [ argument-1 "*" argument-2 ] builds mult-operator-times, mult-operator-divide ::= [ argument-1 "/" argument-2 ] builds mult-operator-divide, mult-operator-mod ::= [ argument-1 "mod" argument-2 ] builds mult-operator-mod, mult-operator-rem ::= [ argument-1 "rem" argument-2 ] builds mult-operator-rem, misc-operator-square %% miscellaneous operators (7.2.7) ::= [ argument-1 "**" argument-2 ] builds misc-operator-square, misc-operator-abs ::= [ "abs" argument-1 ] builds misc-operator-abs, misc-operator-not ::= [ "not" argument-1 ] builds misc-operator-not, aggregate-expression ::= [ "(" element-association-list +"," ")" ] builds aggregate-expression, %% Use back substitution to distinguish from attribute-name qualified-expression ::= [ vhdl-name "'" aggregate-expression ] semantics (lambda (type-mark-1, t1, aggr-1) parser-set-attrs( make-object('qualified-expression), 'type-mark, type-mark-1, 'aggregate-map, aggr-1)), qualified-expression ::= [ type-mark "'" aggregate-map ] print-only, allocator %% allocators (7.3.6) ::= [ ( [ "new" qualified-expr-map ] | [ "new" subtype-indication-map ] ) ] builds allocator, %% Allows a literal to be recognized as an expression expression %% literals (7.3.1) ::= [ literal ] semantics lambda(x) x, %% Allows a name to be recognized as an expression expression %% names (6.1) ::= [ vhdl-name ] semantics lambda(x) x, %% Association Lists association-element %% association list (4.3.2.2) ::= [ formal-or-actual-part-map { [ "=>" actual-part-map ] } ] builds association-element, formal-or-actual-part ::= [ ( discrete-range-map | [ "open" !! open-flag ] ) ] builds formal-or-actual-part, %% Element Associations element-association %% element associations (7.3.2) ::= [ choice-or-expression-value { [ "|" choice-list +"|" ] } { [ "=>" expression-value ] } ] builds element-association, %% Miscellaneous choice %% choices (7.3.2) ::= [ ( [ discrete-range-map ] | [ "others" !! choice-others-flag ] ) ] builds choice, %% Names (Chap. 6) simple-name %% simple name (6.2) ::= [ identifier-map ] builds simple-name, selected-name %% selected name (6.3) ::= [ prefix-map "." ( [ "all" !! suffix-all-flag ] | suffix-character-literal | suffix-simple-name | suffix-operator-symbol) ] builds selected-name, %% Slice name, index name and function call have been combined into %% indexed-or-slice-name. indexed-or-slice-name %% indexed name (6.4) ::= [ prefix-map "(" association-list-map +"," ")" ] builds indexed-or-slice-name, %% Use back substitution to distinguish this from qualified expression attribute-name %% attribute name (6.6) ::= [ vhdl-name "'" identifier ] semantics (lambda (pref-1, t1, id-1) parser-set-attrs( make-object('attribute-name), 'prefix-map, pref-1, 'identifier-map, id-1)), attribute-name ::= [ prefix-map "'" identifier-map ] print-only, attribute-name ::= [ vhdl-name "'" identifier "(" expression ")" ] semantics (lambda (pref-1, t1, id-1, t2, expr-1, t3) parser-set-attrs( make-object('attribute-name), 'prefix-map, pref-1, 'identifier-map, id-1, 'expression-value, expr-1)), attribute-name ::= [ prefix-map "'" identifier-map "(" expression-value ")" ] print-only, attribute-name ::= [ vhdl-name signature "'" identifier ] semantics (lambda (pref-1, sig-1, t1, id-1) parser-set-attrs( make-object('attribute-name), 'prefix-map, pref-1, 'signature-map, sig-1, 'identifier-map, id-1)), attribute-name ::= [ prefix-map signature-map "'" identifier-map ] print-only, attribute-name ::= [ vhdl-name signature "'" identifier "(" expression ")" ] semantics (lambda (pref-1, sig-1, t1, id-1, t2, expr-1, t3) parser-set-attrs( make-object('attribute-name), 'prefix-map, pref-1, 'signature-map, sig-1, 'identifier-map, id-1, 'expression-value, expr-1)), attribute-name ::= [ prefix-map signature-map "'" identifier-map "(" expression-value ")" ] print-only, %% Added because reserved word range is also name of pre-defined attribute. %% See notes in Sec. 13.9. range-attribute-name ::= [ vhdl-name "'" "range" ] semantics (lambda (pref-1, t1, t2) parser-set-attrs( make-object('range-attribute-name), 'prefix-map, pref-1)), range-attribute-name ::= [ prefix-map "'" "range" ] print-only, range-attribute-name ::= [ vhdl-name signature "'" "range" ] semantics (lambda (pref-1, sig-1, t1, t2) parser-set-attrs( make-object('range-attribute-name), 'prefix-map, pref-1, 'signature-map, sig-1)), range-attribute-name ::= [ prefix-map signature-map "'" "range" ] print-only, %% Identifiers identifier %% identifiers (13.3) ::= [ re::--symbol-- ] semantics (lambda(id-name) parser-set-attrs(make-object('identifier), 'name, id-name, 'line-number, *LINE-NUMBER*)), identifier ::= [ name ] print-only, %% Literals (Chap. 13) real-literal %% abstract literals (13.4) ::= [ re::--real-- ] semantics (lambda(real-value) parser-set-attrs(make-object('real-literal), 'real-value-of, real-value, 'line-number, *LINE-NUMBER*)), real-literal ::= [ real-value-of ] print-only, integer-literal ::= [ re::--integer-- ] semantics (lambda(int-value) parser-set-attrs(make-object('integer-literal), 'integer-value-of, int-value, 'line-number, *LINE-NUMBER*)), integer-literal ::= [ integer-value-of ] print-only, character-literal %% character literals (13.5) ::= [ re::--char-- ] semantics (lambda(char-value) parser-set-attrs(make-object('character-literal), 'char-value-of, char-value, 'line-number, *LINE-NUMBER*)), character-literal ::= [ char-value-of ] print-only, string-literal %% string literal (13.6) ::= [ re::--string-- ] semantics (lambda(string-value) parser-set-attrs(make-object('string-literal), 'string-value-of, string-value, 'line-number, *LINE-NUMBER*)), string-literal ::= [ string-value-of ] print-only, bit-string-literal %% bit-string literal (13.7) ::= [ vom-1-0::*bit-string-literal* ] semantics (lambda(bit-string-value) parser-set-attrs(make-object('bit-string-literal), 'bit-string-value-of, bit-string-value, 'line-number, *LINE-NUMBER*)), bit-string-literal ::= [ bit-string-value-of: *bit-string-literal* ] print-only, null-literal ::= [ "null" ] semantics (lambda(arg1) parser-set-attrs(make-object('null-literal), 'line-number, *LINE-NUMBER*)), null-literal ::= [ "null" ] print-only, physical-literal %% physical literal (3.1.3) ::= [ unit-quantifier unit-name ] builds physical-literal, enumeration-literal ::= [ identifier ] semantics lambda(x) x, enumeration-literal ::= [ character-literal ] semantics lambda(x) x precedence #|| Some notes on precedences: -------------------------- - "'" must have a greater precedence than "(" . This gives a qualified-expression higher priority than a attribute-name. This raises the question are certain productions for attribute-name really needed at all? For now they are left in. (db - 10/5) - "if", "elsif" and "else" added to resolve the dangling else problem. (db - 10/7) - for expression precedence, see Sec. 7.2. (db - 10/7) ||# %% Automatically adds the production: expression ::= ( expression ) for expression brackets "(" matching ")" (same-level "range"), (same-level "and", "or", "nand", "nor", "xor", "xnor" associativity left), (same-level "=", "/=", "<", "<=", ">", ">=" associativity left), (same-level "sll", "srl", "sla", "sra", "rol", "ror" associativity left), (same-level "+", "-", "&" associativity left), (same-level "*", "/", "mod", "rem" associativity left), (same-level "**", "abs", "not" associativity left), (same-level "downto", "to"), (same-level "("), (same-level "'"), (same-level "if" associativity right), (same-level "elsif" associativity right), (same-level "else" associativity right) lexical-analysis-fn lex-vhdl brackets "(" matching ")", "[" matching "]" end