boschresearch / blech

Blech is a language for developing reactive, real-time critical embedded software.
Apache License 2.0
72 stars 5 forks source link

support for hex literals #7

Closed mterber closed 4 years ago

mterber commented 4 years ago

Is your feature request related to a problem? Please describe. Not only but especially in the embedded context, it is common to write integer literals as hex values. This is particularly true for hardware manuals that define register addresses and commands in order to interact with the device. Today, writing hex literals is not supported in Blech. Thus, the user has to "translate" every value, e.g. from a microcontroller manual, into decimal values. This is a error-prone task and makes it difficult to cross-check source code and hardware documentation.

Describe the solution you'd like I would like to be able to write something like var cmd: uint8 = 0xC3 or var data: [3]uint8 = {0xA4, 0x05, 0xF7} in Blech.

schorg commented 4 years ago

Startet to implemented this in feature branch 'feature/bits-and-bytes'. There is an evolution proposal how to do this: bits-and-bytes.adoc

schorg commented 4 years ago

Hex literals now possible. Feature branch is integrated into master.