jasmin-lang / jasmin

Language for high-assurance and high-speed cryptography
MIT License
271 stars 55 forks source link

Modifying jasmin2tex integer representation to fit source integer representation better #886

Closed MrDaiki closed 2 months ago

MrDaiki commented 2 months ago

Issue

jasmin2tex program always convert integer from source file to base 10. In certain cases, it makes readability of the program harder. For example :

tab[i] = 0xab;

is converted to :

\jasminindent{2}tab[i] = 172;\\

Solution

We implement a new Syntax node pbinteger that store the raw integer string coming from source file :

type pbinteger = {zvalue:Z.t; raw:string}

At pretyping, we convert this type back to Z.t, which mean that it does not affect the behavior of the compiler for all next compilation steps. Since latex_printer is executed before pre-typing, we can use the raw string for generating latex file. The new output is now :

\jasminindent{2}tab[i] = 0xab;\\

Changelog