TheThirdOne / rars

RARS -- RISC-V Assembler and Runtime Simulator
Other
1.14k stars 217 forks source link

Add binary literal #190

Open privat opened 11 months ago

privat commented 11 months ago

Add binary literal syntax, e.g. 0b101010.

Decimal, hexadecimal, and octal are already handled, but binary was missing. Binary literals are useful for testing flags and to teach binary to students.

This is consistent with the GNU assembler syntax that accept it https://sourceware.org/binutils/docs-2.40/as/Integers.html

Add also some simple tests on integer literals.