From b2d9eacd26e8283f438bc6429770497290d5b9c3 Mon Sep 17 00:00:00 2001 From: Jack Date: Tue, 2 Feb 2016 11:49:38 -0800 Subject: 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 --- src/main/antlr4/FIRRTL.g4 | 36 +++++++++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) (limited to 'src/main/antlr4') 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 -- cgit v1.2.3