summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/compiler/types.lm4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/compiler/types.lm b/src/compiler/types.lm
index b33adf7..a371695 100644
--- a/src/compiler/types.lm
+++ b/src/compiler/types.lm
@@ -10,14 +10,18 @@ context number
token OCT / '0'[0-7]+ /
token DEC / [0-9]+ /
token HEX / '0x' xdigit+ /
+ literal `0b
end
+ token BIN / [0-1]+ /
+
int strtoull(a:str, b:int) = c_strtoull
def type
value:int
[`false] { lhs.value = 0 }
| [`true] { lhs.value = 1 }
+ | [`0b BIN] { lhs.value = strtoull($r2, 2) }
| [OCT] { lhs.value = strtoull($r1, 8) }
| [DEC] { lhs.value = strtoull($r1, 10) }
| [HEX] { lhs.value = strtoull($r1, 16) }