aboutsummaryrefslogtreecommitdiff
path: root/src/main/stanza/ir-parser.stanza
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/stanza/ir-parser.stanza')
-rw-r--r--src/main/stanza/ir-parser.stanza10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/main/stanza/ir-parser.stanza b/src/main/stanza/ir-parser.stanza
index cbfe106e..588efeac 100644
--- a/src/main/stanza/ir-parser.stanza
+++ b/src/main/stanza/ir-parser.stanza
@@ -81,6 +81,10 @@ defsyntax firrtl :
int = (?x) when unwrap-token(x) typeof Int :
unwrap-token(x)
+ ;Parses next form if long literal
+ intorlong = (?x) when unwrap-token(x) typeof Int|Long :
+ unwrap-token(x)
+
;Parses next form if symbol
sym = (?x) when unwrap-token(x) typeof Symbol :
unwrap-token(x)
@@ -107,6 +111,10 @@ defsyntax firrtl :
int$ = (?i:#int ?rest ...) when empty?(rest) : i
int$ != () : FPE(form, "Expected a single integer literal here.")
+ ;Error if not a single long integer
+ long$ = (?i:#intorlong ?rest ...) when empty?(rest) : to-long(i)
+ long$ != () : FPE(form, "Expected a single long integer literal here.")
+
;Error if not a single width
width$ = (?w:#width ?rest ...) when empty?(rest) : w
width$ != () : FPE(form, "Expected a single width specifier here.")
@@ -227,7 +235,7 @@ defsyntax firrtl :
expop = (. ?f:#id!) : (fn (x) : Subfield(x, f, UnknownType()))
;Prefix Operators
- expterm = (?t:#inttype(?v:#int$)) :
+ expterm = (?t:#inttype(?v:#long$)) :
match(t) :
(t:UIntType) : UIntValue(v, width(t))
(t:SIntType) : SIntValue(v, width(t))