Lexical Conventions
Anvil follows standard lexical rules like SystemVerilog.
Whitespace
Whitespace separates identifiers, literals, and keywords. It is otherwise ignored, except inside string literals, where it forms part of the value.
Identifiers
Identifiers consist of letters, digits, and underscores, but must start with either a letter or an underscore. In the grammar, non-terminals are prefixed with $.
identifier ::= ( $letter | _ ) { $letter | $digit | _ }
letter ::= a...z | A...Z
digit ::= 0...9
Examples of valid identifiers:
counter
_data
temp32
Invalid identifiers:
3value // cannot start with a digit
Comments
Anvil supports two kinds of comments:
Block comments begin with
/*and end with*/. They may appear inline or span multiple lines./* This is a block comment */Inline comments start with
//and continue to the end of the line.// This is an inline comment