• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
      • Gl
      • Esim
      • Vl2014
        • Warnings
        • Primitives
        • Use-set
        • Syntax
        • Getting-started
        • Utilities
        • Loader
          • Preprocessor
          • Vl-loadconfig
          • Lexer
          • Vl-loadstate
          • Parser
            • Parse-expressions
            • Parse-udps
            • Vl-genelements
            • Parse-paramdecls
            • Parse-blockitems
            • Parse-utils
            • Parse-insts
            • Parse-datatype
            • Parse-functions
            • Parse-datatypes
            • Parse-strengths
            • Vl-parse-genvar-declaration
            • Vl-parse
            • Parse-ports
            • Seq
            • Parse-packages
          • Vl-load-merge-descriptions
          • Scope-of-defines
          • Vl-load-file
          • Vl-flush-out-descriptions
          • Vl-description
          • Vl-loadresult
          • Vl-read-file
          • Vl-find-basename/extension
          • Vl-find-file
          • Vl-read-files
          • Extended-characters
          • Vl-load
          • Vl-load-main
          • Vl-load-description
          • Vl-descriptions-left-to-load
          • Inject-warnings
          • Vl-load-descriptions
          • Vl-load-files
          • Vl-load-summary
          • Vl-collect-modules-from-descriptions
          • Vl-descriptionlist
        • Transforms
        • Lint
        • Mlib
        • Server
        • Kit
        • Printer
        • Esim-vl
        • Well-formedness
      • Sv
      • Fgl
      • Vwsim
      • Vl
      • X86isa
      • Svl
      • Rtl
    • Software-verification
    • Math
    • Testing-utilities
  • Loader

Parser

A parser for a subset of Verilog and SystemVerilog.

Introduction

Our parser is responsible for processing a list of tokens into our internal representation of Verilog syntax. Typically these tokens are produced by the lexer. Note that before parsing begins, any whitespace or comment tokens should be removed from the token list; see for instance vl-kill-whitespace-and-comments.

We use essentially a manual recursive-descent style parser. Having the entire token stream available gives us arbitrary lookahead, and we occasionally make use of backtracking.

Scope

Verilog and SystemVerilog are huge languages, and we can parse only a subset of these languages.

We can currently support most of the constructs in the Verilog 1364-2005 standard. Notably, we do not yet support user-defined primitives, generate statements, specify blocks, specparams, and genvars. In some cases, the parser will just skip over unrecognized constructs (adding warnings when it does so.) Depending on what you are doing, this behavior may be actually appropriate, e.g., skipping specify blocks may be okay if you aren't trying to deal with low-level timing issues.

We are beginning to work toward supporting SystemVerilog based on the 1800-2012 standard. But this is preliminary work and you should not yet expect VL to correctly handle any interesting fragment of SystemVerilog.

Subtopics

Parse-expressions
Parser for Verilog and SystemVerilog expressions.
Parse-udps
Functions for parsing User Defined Primitives (UDPs).
Vl-genelements
Parser for elements contained within modules, interfaces, etc., including generate constructs.
Parse-paramdecls
Functions for parsing parameter declarations.
Parse-blockitems
Functions for parsing Verilog and SystemVerilog block items.
Parse-utils
Supporting functions for the parser.
Parse-insts
Functions for parsing module instances.
Parse-datatype
Parser for SystemVerilog-2012 data types.
Parse-functions
Functions for parsing Verilog-2005 and SystemVerilog function and task declarations.
Parse-datatypes
Functions for parsing SystemVerilog data types.
Parse-strengths
Functions for parsing drive/charge strengths.
Vl-parse-genvar-declaration
Match genvar_declaration.
Vl-parse
Top level parsing function.
Parse-ports
Functions for parsing Verilog and SystemVerilog ports.
Seq
A variant of ACL2::seq for use in VL's parser.
Parse-packages
Functions for parsing SystemVerilog packages.