|
From: Pete J. <pe...@be...> - 2015-01-09 02:15:53
|
Evan, What you suggest is not how the mod port syntax works. It uses the keywords “input” and “output”, not “in” and “out”. Here is an example from the standard interface i2; wire a, b, c, d; modport master (input a, b, output c, d); modport slave (output a, b, input c, d); endinterface Martin never told us what the non-terminal “port_direction” matches from parse.y in the icarus source it looks like it can be the keywords “input”, “output”, “inout” or “ref”. So, my guess is that the issue arises when the parser has parsed the identifier “b” and is now staring at a comma. Should it shift the comma and continue with the modport_simple_port_list non-terminal or should it reduce that and start a new mod port_ports_declaration. It is possible that Martin could use the GLR algorithm with bison rather than the default LR(1) algorithm. This would resolve the issue by essentially allowing more than one lookahead token. See http://www.gnu.org/software/bison/manual/html_node/Simple-GLR-Parsers.html <http://www.gnu.org/software/bison/manual/html_node/Simple-GLR-Parsers.html> for details on this. Otherwise you would need to have some semantic tie-in to the lexor. You would basically clue it in to the fact that you are parsing a modport and if it sees a comma followed by input, output, inout, or ref to have it conveniently return a new type of token which is not a comma, but something which explicitly indicates to the parser that the modport_simple_port_list is ending and needs to be reduced. -Pete |