aboutsummaryrefslogtreecommitdiff
path: root/src/main/antlr4
diff options
context:
space:
mode:
authorJack2016-02-02 11:49:38 -0800
committerazidar2016-02-09 18:57:06 -0800
commitb2d9eacd26e8283f438bc6429770497290d5b9c3 (patch)
tree4eff98b858a049bc533a6fcaf10888a331c6e773 /src/main/antlr4
parent43ecab5aec6751d05ac986570e0648bb3d90982a (diff)
Adding ScalaTest for unit testing of Scala FIRRTL. Added a few basic tests for the Parser. Added custom Parser exceptions for better error reporting and checking. Fixed bug in grammar not allowing most keywords as Ids
Diffstat (limited to 'src/main/antlr4')
-rw-r--r--src/main/antlr4/FIRRTL.g436
1 files changed, 33 insertions, 3 deletions
diff --git a/src/main/antlr4/FIRRTL.g4 b/src/main/antlr4/FIRRTL.g4
index 2faef4e0..e0e10d45 100644
--- a/src/main/antlr4/FIRRTL.g4
+++ b/src/main/antlr4/FIRRTL.g4
@@ -93,12 +93,42 @@ id
| keyword
;
-// TODO add all keywords
keyword
- : dir
- | 'inst'
+ : 'circuit'
+ | 'module'
+ | 'input'
+ | 'output'
+ | 'UInt'
+ | 'SInt'
+ | 'UBits'
+ | 'SBits'
+ | 'Clock'
+ | 'wire'
+ | 'reg'
| 'mem'
| 'reset'
+ | 'data-type'
+ | 'depth'
+ | 'read-latency'
+ | 'write-latency'
+ | 'read-under-write'
+ | 'reader'
+ | 'writer'
+ | 'readwriter'
+ | 'inst'
+ | 'node'
+ | 'is'
+ | 'invalid'
+ | 'when'
+ | 'else'
+ | 'stop'
+ | 'printf'
+ | 'skip'
+ | 'old'
+ | 'new'
+ | 'undefined'
+ | 'mux'
+ | 'validif'
;
// Parentheses are added as part of name because semantics require no space between primop and open parentheses