Grammar SystemRDLParser ANTLR-generated HTML file from SystemRDL.g Terence Parr, MageLang Institute ANTLR Version 2.7.6 (20060925); 1989-2005

    Definition of parser SystemRDLParser, which is a subclass of LLkParser.

    root
        :   (   component_def
            |   enum_def
            |   explicit_component_inst
            |   property_assign
            |   property_definition
            )*
            EOF
        ;

    component_def
        :   (   "addrmap"
            |   "regfile"
            |   "reg"
            |   "field"
            |   "signal"
            )
            (   id
            |
            )
            LBRACE
            (   component_def
            |   explicit_component_inst
            |   property_assign
            |   enum_def
            )*
            RBRACE
            (   anonymous_component_inst_elems
            |
            )
            SEMI
        ;

    enum_def
        :   "enum" id enum_body SEMI
        ;

    explicit_component_inst
        :   (   "external"
            |
            )
            (   "internal"
            |
            )
            (   "alias" id
            |
            )
            id component_inst_elem ( COMMA component_inst_elem )* SEMI
        ;

    property_assign
        :   default_property_assign SEMI
        |   explicit_property_assign SEMI
        |   post_property_assign SEMI
        ;

    property_definition
        :   "property" id LBRACE property_body RBRACE SEMI
        ;

    id
        :   ID
        |   INST_ID
        ;

    property_body
        :   property_type
            (   property_usage
                (   property_default
                |
                )
            |   property_default property_usage
            )
        |   property_usage
            (   property_type
                (   property_default
                |
                )
            |   property_default property_type
            )
        |   property_default
            (   property_type property_usage
            |   property_usage property_type
            )
        ;

    property_type
        :   "type" EQ
            (   property_string_type
            |   property_number_type
            |   property_boolean_type
            |   property_ref_type
            )
            SEMI
        ;

    property_usage
        :   "component" EQ property_component ( OR property_component )* SEMI
        ;

    property_default
        :   ( "default" EQ
                (   str
                |   num
                |   "true"
                |   "false"
                )
                SEMI )
        ;

    property_string_type
        :   "string"
        ;

    property_number_type
        :   "number"
        ;

    property_boolean_type
        :   "boolean"
        ;

    property_ref_type
        :   (   "addrmap"
            |   "reg"
            |   "regfile"
            |   "field"
            |   "ref"
            )
        ;

    str
        :   STR
        ;

    num
        :   NUM
        ;

    property_component
        :   (   "signal"
            |   "addrmap"
            |   "reg"
            |   "regfile"
            |   "field"
            |   "all"
            )
        ;

    anonymous_component_inst_elems
        :   (   "external"
            |
            )
            component_inst_elem ( COMMA component_inst_elem )*
        ;

    component_inst_elem
        :   id
            (   array
            |
            )
            (   EQ num
            |
            )
            (   AT num
            |
            )
            (   INC num
            |
            )
            (   MOD num
            |
            )
        ;

    array
        :   LSQ num
            (   COLON num
            |
            )
            RSQ
        ;

    instance_ref
        :   instance_ref_elem ( DOT instance_ref_elem )*
            (   DREF property
            |
            )
        ;

    instance_ref_elem
        :   id
            (   LSQ num RSQ
            |
            )
        ;

    property
        :   "name"
        |   "desc"
        |   "arbiter"
        |   "rset"
        |   "rclr"
        |   "woclr"
        |   "woset"
        |   "we"
        |   "wel"
        |   "swwe"
        |   "swwel"
        |   "hwset"
        |   "hwclr"
        |   "swmod"
        |   "swacc"
        |   "sticky"
        |   "stickybit"
        |   "intr"
        |   "anded"
        |   "ored"
        |   "xored"
        |   "counter"
        |   "overflow"
        |   "sharedextbus"
        |   "errextbus"
        |   "reset"
        |   "littleendian"
        |   "bigendian"
        |   "rsvdset"
        |   "rsvdsetX"
        |   "bridge"
        |   "shared"
        |   "msb0"
        |   "lsb0"
        |   "sync"
        |   "async"
        |   "cpuif_reset"
        |   "field_reset"
        |   "activehigh"
        |   "activelow"
        |   "singlepulse"
        |   "underflow"
        |   "incr"
        |   "decr"
        |   "incrwidth"
        |   "decrwidth"
        |   "incrvalue"
        |   "decrvalue"
        |   "saturate"
        |   "decrsaturate"
        |   "threshold"
        |   "decrthreshold"
        |   "dontcompare"
        |   "donttest"
        |   "internal"
        |   "alignment"
        |   "regwidth"
        |   "fieldwidth"
        |   "signalwidth"
        |   "accesswidth"
        |   "sw"
        |   "hw"
        |   "addressing"
        |   "precedence"
        |   "encode"
        |   "resetsignal"
        |   "clock"
        |   "mask"
        |   "enable"
        |   "hwenable"
        |   "hwmask"
        |   "haltmask"
        |   "haltenable"
        |   "halt"
        |   "next"
        |   PROPERTY
        ;

    default_property_assign
        :   "default" explicit_property_assign
        ;

    explicit_property_assign
        :   property_modifier property
        |   property ( EQ property_assign_rhs )
        ;

    post_property_assign
        :   instance_ref ( EQ property_assign_rhs )
        ;

    property_modifier
        :   "posedge"
        |   "negedge"
        |   "bothedge"
        |   "level"
        |   "nonsticky"
        ;

    property_assign_rhs
        :   property_rvalue_constant
        |   "enum" enum_body
        |   instance_ref
        |   concat
        ;

    property_rvalue_constant
        :   "true"
        |   "false"
        |   "rw"
        |   "wr"
        |   "r"
        |   "w"
        |   "na"
        |   "compact"
        |   "regalign"
        |   "fullalign"
        |   "hw"
        |   "sw"
        |   num
        |   str
        ;

    enum_body
        :   LBRACE ( enum_entry )* RBRACE
        ;

    concat
        :   LBRACE concat_elem ( COMMA concat_elem )* RBRACE
        ;

    concat_elem
        :   instance_ref
        |   num
        ;

    enum_entry
        :   id EQ num
            (   LBRACE ( enum_property_assign )* RBRACE
            |
            )
            SEMI
        ;

    enum_property_assign
        :   (   "name"
            |   "desc"
            )
            EQ str SEMI
        ;