diff options
author | Jari Vetoniemi <mailroxas@gmail.com> | 2018-09-27 02:43:50 +0300 |
---|---|---|
committer | Jari Vetoniemi <mailroxas@gmail.com> | 2018-09-27 02:43:50 +0300 |
commit | a2b69e5b9479ddeba3c737c8ef01764d5454520c (patch) | |
tree | 9ef02540b4f9c877ab73d8ca978bc89f073fd2e6 /src/compiler | |
parent | 5d253b30c5d84857d06393b77ce91fb974061665 (diff) |
implement the binary number type
Diffstat (limited to 'src/compiler')
-rw-r--r-- | src/compiler/types.lm | 4 |
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) } |