[libre-riscv-dev] [Bug 72] verilog to nmigen converter (full or partial) needed

bugzilla-daemon at libre-riscv.org bugzilla-daemon at libre-riscv.org
Thu Apr 25 17:54:43 BST 2019


http://bugs.libre-riscv.org/show_bug.cgi?id=72

--- Comment #11 from Luke Kenneth Casson Leighton <lkcl at lkcl.net> ---
> Hendrik Boom hendrik at topoi.pooq.com via lists.libre-riscv.org 
> 5:44 PM (1 minute ago)

> > *shocked*!!  that's one mmmmaaaaasive number of parser states!

> It makes me suspect that either the language isn't well-designed,
> or that the grammar formalism isn't a good match for the language.

to be fair, i used an auto-conversion tool (dabeaz yply.py) which
instead of keeping groups of ORed BNF syntax-rules together (which
would appear to keep numbers down), the tool split them out as
individual functions.

this does make the code less costly to write (no need to test
the length of the list of tokens), however it kiiinda gives
the false impression that the *syntax* is faulty.

udp_initial_expr_opt
    : '=' expression { $$ = $2; }
    |                { $$ = 0; }
    ;

becomes:

def p_udp_initial_expr_opt_1(p):
    '''udp_initial_expr_opt : '=' expression '''
    print('udp_initial_expr_opt_1', list(p))
    p[0] = p[2]

def p_udp_initial_expr_opt_2(p):
    '''udp_initial_expr_opt :  '''
    print('udp_initial_expr_opt_2', list(p))
    # { $$ = 0; }

yes that was me working out that "{ $$ = $2 }" can be global/search/replaced
with "p[0] = p[2]".

that's about 20% of the 1,000 rules done, right there.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the libre-riscv-dev mailing list