How to get emacs calc to recognize System Verilog formatted numbers

1

System verilog allows numeric constants like this:

32'hdead_beef this is equivalent to the c value of 0xdeadbeef

System verilog allows the bit width to be defined as well as the base.

In general it is

<bit-width-in-decimal>'<base><digits-and-underscore>
<base> can be:
  • 'd' for decimal
  • 'h' for hexadecimal
  • 'o' for octal
  • 'b' binary

The underscore is ignored by the parser and is used for human readability. The hex digits are case insensitive.

The question is how to describe to calc this style of numbers.

I presume I will have to define a new language to calc. (it supports c/c++, Pascal, Fortran, and others.)

Is there a tutorial for how to add new calc languages?

Is there a special "syntax" table or regular expression that describes the input format?

Thanks for any help

Ian

emacs
asked on Stack Overflow May 25, 2020 by user3435751

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0