Skip to content

Unsized numbers without base solution #127

Open
@YSJL

Description

@YSJL

I had the same problem as issue #116
However, I was able to fix the problem by adding a new type of number with the provided structure.
Already made a comment on said issue, but making a new one for visibility.

You can edit lexer.py, parser.py, ast.py using already existing structures.
For lexer,py:

  • Add at line 89 within tokens = keywords + operators + ()
    'UNSIZEDNUMBER',
  • line 184
    unsized_number = '\'[0-1xXzZ?]'
  • line 218
    @TOKEN(unsized_number)
    def t_UNSIZEDNUMBER(self, t):
    return t

For parser.py:

  • line 1266
    def p_const_expression_unsizednum(self, p):
    'const_expression : unsizednumber'
    p[0] = UnsizedConst(p[1], lineno=p.lineno(1))
    p.set_lineno(0, p.lineno(1))
  • line 1281
    def p_unsizednumber(self, p):
    'unsizednumber : UNSIZEDNUMBER'
    p[0] = p[1]
    p.set_lineno(0, p.lineno(1))
  • line 1498
    def p_delays_unsizednumber(self, p):
    'delays : DELAY unsizednumber'
    p[0] = DelayStatement(UnsizedConst(
    p[2], lineno=p.lineno(1)), lineno=p.lineno(1))
    p.set_lineno(0, p.lineno(1))

For ast.py:

  • line 267
    class UnsizedConst(Constant):
    pass

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions