Admin/Benchmarks/HOL-datatype/Verilog.thy
changeset 7013 8a7fb425e04a
child 7373 776d888472aa
equal deleted inserted replaced
7012:ae9dac5af9d1 7013:8a7fb425e04a
       
     1 (*  Title:      Admin/Benchmarks/HOL-datatype/Verilog.thy
       
     2     ID:         $Id$
       
     3 *)
       
     4 
       
     5 Verilog = Main +
       
     6 
       
     7 (* ------------------------------------------------------------------------- *)
       
     8 (* Example from Daryl: a Verilog grammar.                                    *)
       
     9 (* ------------------------------------------------------------------------- *)
       
    10 
       
    11 datatype
       
    12   Source_text
       
    13      = module string (string list) (Module_item list)
       
    14      | Source_textMeta string
       
    15 and
       
    16   Module_item
       
    17      = declaration Declaration
       
    18      | initial Statement
       
    19      | always Statement
       
    20      | assign Lvalue Expression
       
    21      | Module_itemMeta string
       
    22 and
       
    23   Declaration
       
    24      = reg_declaration (Range option) (string list)
       
    25      | net_declaration (Range option) (string list)
       
    26      | input_declaration (Range option) (string list)
       
    27      | output_declaration (Range option) (string list)
       
    28      | DeclarationMeta string
       
    29 and
       
    30   Range = range Expression Expression | RangeMeta string
       
    31 and
       
    32   Statement
       
    33      = clock_statement Clock Statement_or_null
       
    34      | blocking_assignment Lvalue Expression
       
    35      | non_blocking_assignment Lvalue Expression
       
    36      | conditional_statement
       
    37           Expression Statement_or_null (Statement_or_null option)
       
    38      | case_statement Expression (Case_item list)
       
    39      | while_loop Expression Statement
       
    40      | repeat_loop Expression Statement
       
    41      | for_loop
       
    42           Lvalue Expression Expression Lvalue Expression Statement
       
    43      | forever_loop Statement
       
    44      | disable string
       
    45      | seq_block (string option) (Statement list)
       
    46      | StatementMeta string
       
    47 and
       
    48   Statement_or_null
       
    49      = statement Statement | null_statement | Statement_or_nullMeta string
       
    50 and
       
    51   Clock
       
    52      = posedge string
       
    53      | negedge string
       
    54      | clock string
       
    55      | ClockMeta string
       
    56 and
       
    57   Case_item
       
    58      = case_item (Expression list) Statement_or_null
       
    59      | default_case_item Statement_or_null
       
    60      | Case_itemMeta string
       
    61 and
       
    62   Expression
       
    63      = plus Expression Expression
       
    64      | minus Expression Expression
       
    65      | lshift Expression Expression
       
    66      | rshift Expression Expression
       
    67      | lt Expression Expression
       
    68      | leq Expression Expression
       
    69      | gt Expression Expression
       
    70      | geq Expression Expression
       
    71      | logeq Expression Expression
       
    72      | logneq Expression Expression
       
    73      | caseeq Expression Expression
       
    74      | caseneq Expression Expression
       
    75      | bitand Expression Expression
       
    76      | bitxor Expression Expression
       
    77      | bitor Expression Expression
       
    78      | logand Expression Expression
       
    79      | logor Expression Expression
       
    80      | conditional Expression Expression Expression
       
    81      | positive Primary
       
    82      | negative Primary
       
    83      | lognot Primary
       
    84      | bitnot Primary
       
    85      | reducand Primary
       
    86      | reducxor Primary
       
    87      | reducor Primary
       
    88      | reducnand Primary
       
    89      | reducxnor Primary
       
    90      | reducnor Primary
       
    91      | primary Primary
       
    92      | ExpressionMeta string
       
    93 and
       
    94   Primary
       
    95      = primary_number Number
       
    96      | primary_IDENTIFIER string
       
    97      | primary_bit_select string Expression
       
    98      | primary_part_select string Expression Expression
       
    99      | primary_gen_bit_select Expression Expression
       
   100      | primary_gen_part_select Expression Expression Expression
       
   101      | primary_concatenation Concatenation
       
   102      | primary_multiple_concatenation Multiple_concatenation
       
   103      | brackets Expression
       
   104      | PrimaryMeta string
       
   105 and
       
   106   Lvalue
       
   107      = lvalue string
       
   108      | lvalue_bit_select string Expression
       
   109      | lvalue_part_select string Expression Expression
       
   110      | lvalue_concatenation Concatenation
       
   111      | LvalueMeta string
       
   112 and
       
   113   Number
       
   114      = decimal string
       
   115      | based (string option) string
       
   116      | NumberMeta string
       
   117 and
       
   118   Concatenation
       
   119      = concatenation (Expression list) | ConcatenationMeta string
       
   120 and
       
   121   Multiple_concatenation
       
   122      = multiple_concatenation Expression (Expression list)
       
   123      | Multiple_concatenationMeta string
       
   124 and
       
   125   meta
       
   126      = Meta_Source_text Source_text
       
   127      | Meta_Module_item Module_item
       
   128      | Meta_Declaration Declaration
       
   129      | Meta_Range Range
       
   130      | Meta_Statement Statement
       
   131      | Meta_Statement_or_null Statement_or_null
       
   132      | Meta_Clock Clock
       
   133      | Meta_Case_item Case_item
       
   134      | Meta_Expression Expression
       
   135      | Meta_Primary Primary
       
   136      | Meta_Lvalue Lvalue
       
   137      | Meta_Number Number
       
   138      | Meta_Concatenation Concatenation
       
   139      | Meta_Multiple_concatenation Multiple_concatenation
       
   140 
       
   141 end