TWiki
>
P1076 Web
>
Vhdl2019CollectedRequirements
>
OptionalSemicolon
(revision 7) (raw view)
Edit
Attach
---+ Extra optional semicolon at the end of interface_list %TOC% ---++ Proposal Details * Who Updates: Bert de Jong * Date Proposed: 24 Oktober 2013 * Date Last Updated: 25 Oktober 2013 * Priority: * Complexity: very easy * Focus: ---++ Language Change Specification Link [[LCS2016_071a][LCS-2016-071a]] [[TopLCS2016_071b][LCS-2016-071b]] for related optional extra commas. ---+++ Current Situation Throughout the standard semicolons are used as termination characters, except for generic, port, function and procedure declarations, where they are used as separation characters. Having the option to add another semicolon after the last element would make the language seem more consistent. ---+++ Requirement ---+++ Implementation details The only syntax rule that would have to be changed is: <div id="_mcePaste">interface_list ::=</div> <div id="_mcePaste">interface_declaration {';' interface_declaration}</div> To: <div id="_mcePaste">interface_list ::=</div> <div id="_mcePaste">interface_declaration {';' interface_declaration} [;]</div> ---+++ Code Examples ---++ Current situation entity someEntity is<br /> port<br /> (<br /> a : std_logic;<br /> b : integer<br /> );<br /> end entity; ---++ New situation entity someEntity is<br /> port<br /> (<br /> a : std_logic;<br /> b : integer;<br /> );<br />end entity; ---++ Use Cases ---++ Arguments FOR -- Main.ErnstChristen - 2015-01-21 Since in VHDL the semicolon is a statement terminator it could be argued that current syntax is not consistent. -- Main.RobGaddi - 2015-02-02 I've certainly found that currently illegal trailing semicolons are one of the things that frequently give me "stupid" syntax errors; i.e. syntax errors that in no way request illegal things or create ambiguities as to my intention, but simply fall afoul of some semantic quibble. It makes programmatically generating code, re-ordering port lists for clarity, and even copying and pasting from one design to the next fractionally harder than it needs to be. Optional semicolons would be a fairly minor win, but implementationally it's a fairly minor lift as well. ---++ Arguments AGAINST ---++ General Comments -- Main.DavidKoontz - 2015-02-14 interface_list isn't a terminal production (it consumes no tokens in and of itself). Adding a superfluous semicolon _delimiter_ to a non-terminal has the effect of changing a parser from (theoretically) a single token look ahead to a look ahead of two (from my interface_list.c): <verbatim>NEXT_INTERFACE__ELEMENT: last_token = token; token = get_token(); switch (token) { case DELIM_SEMICOLON: emit(END,""); /* INTERFACE_DECLARATION */ goto INTERFACE__LIST; /* more interface declarations */ break; case DELIM_RIGHT_PAREN: emit(END,""); /* INTERFACE_LIST */ goto INTERFACE__LIST_END; break; default: emit(SYNTAX_ERROR,"INTERFACE ELEMENT, expected ';' or ')'"); break; } INTERFACE__LIST_END: if (intf_list_class == INTF_LIST_CLASS_PARAMETER) return; /* interface list termination for subprograms handled externally */ /* else */ last_token = token; token = get_token(); if (token != DELIM_SEMICOLON) { if (intf_list_class == INTF_LIST_CLASS_PORT) emit(SYNTAX_ERROR,"PORT_CLAUSE, expected terminating ';'"); else if (intf_list_class == INTF_LIST_CLASS_GENERIC) emit(SYNTAX_ERROR,"GENERIC_CLAUSE, expected terminating ';'"); } emit(END,""); /* PORT_CLAUSE or GENERIC_CLAUSE */ return; /* if not SYNTAX_ERROR */ </verbatim> As seen in the above code the descision to process another inteface object declaration is made when encountering a semicolon. If a right parenthesis is found instead the interface list is finished (and you subsequently require a semicolon for closing the port declaration). With the change you now require a further token look ahead to determine whether the next token following a semicolon is a right parenthesis or something else (discounting comments which are not delivered to the parser). Requiring the look ahead can imply either a token stack, returning the token (presumably either a reserved word or an identifier) for an entry point that fetches a new token or an additional entry point (which isn't reflected in the EBNF). In any event there's a requirement to change parser structure to accomidate the changed syntax adding a superfluous semicolon. And yes I recognize that it's possible to use an LALR(k) parser to traverse a VHDL description. The point is that a priori (presumably, the above code is from my -1993 parser) there wasn't a requirement to change parser architecture. (And in my parser I don't have a peek or token put back I actually use predicate tests implied in the EBNF. I do have that ability peek ahead in the lexer. In this case the parser would require a new entry point (a label) because I use those evil goto statements and I'd need to go around a token fetch.) For someone implementing a minimal LALR(1) parser you could be forcing them to change the fundamental tool used to create the parser or rewrite their parser for this one superfluous semicolon. And the point of all this is that tool vendors should be involved in these feature changes. The likelihood of feature uptake may hang in the balance. -- Main.GerdEhlers - 2016-08-01 Parser programmers may evaluate if other syntax variants are better to implement. *Alternative 2*, change these: port_list ::= port_interface_list<br /> generic_list ::= generic_interface_list <br /> formal_parameter_list ::= parameter_interface_list to: port_list ::= port_interface_list [;]<br /> generic_list ::= generic_interface_list [;] <br /> formal_parameter_list ::= parameter_interface_list [;]<br /><br /><b>Alternative 3</b>, change these: port_clause ::= PORT ( port_list ) ; generic_clause ::= GENERIC ( generic_list ) ; subprogram_specification ::= PROCEDURE designator [ ( formal_parameter_list ) ]<br /> | [ PURE | IMPURE ] FUNCTION designator [ ( formal_parameter_list ) ]<br /> RETURN type_mark<br /> <br />to: port_clause ::= PORT ( port_list [;] ) ; generic_clause ::= GENERIC ( generic_list [;] ) ; subprogram_specification ::= PROCEDURE designator [ ( formal_parameter_list [;] ) ]<br /> | [ PURE | IMPURE ] FUNCTION designator [ ( formal_parameter_list [;] ) ]<br /> RETURN type_mark ---++ Supporters _Add your signature here to indicate your support for the proposal_ _-- Main.JimLewis - 2014-12-04_ -- Main.MortenZilmer - 2015-01-21 -- Main.ErnstChristen - 2015-01-21 -- Main.RobGaddi - 2015-02-02 -- Main.LievenLemiengre - 2015-06-04 -- Main.GerdEhlers - 2016-08-01 -- Main.HendrikEeckhaut - 2016-10-08 -- Main.JakkoVerhallen - 2016-12-13
Edit
|
Attach
|
P
rint version
|
H
istory
:
r16
|
r9
<
r8
<
r7
<
r6
|
B
acklinks
|
V
iew topic
|
Raw edit
|
More topic actions...
Topic revision: r1 - 2020-02-17 - 15:34:36 -
TWikiGuest
P1076
Log In
or
Register
P1076 Web
Create New Topic
Index
Search
Changes
Notifications
RSS Feed
Statistics
Preferences
Webs
Main
P1076
Ballots
LCS2016_080
P10761
P1647
P16661
P1685
P1734
P1735
P1778
P1800
P1801
Sandbox
TWiki
VIP
VerilogAMS
Copyright © 2008-2025 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki?
Send feedback