jasmin-lang / jasmin

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

Authorizing variable initialisation at declaration #899

Closed MrDaiki closed 2 months ago

MrDaiki commented 2 months ago

Issue

describe in Issue #743. The idea of this new feature is to authorize initialization of variables at their declaration. For example:

reg u64 x=1;

Implementation

With the proposed implementation, we can also initialize multiple variables at the same time:

reg u64 x=1,y=2,z,t=3;

The current implementation doesn't support array initializing with this feature because array can currently be explicitly created only at top level. Allowing it would require reworking a large part of the grammar and pre-typing analysis.

In terms of semantic, the proposed implementation works as follow :

reg u64 x=3;

is abstractly equivalent to :

reg u64 x;
x=3;
vbgl commented 2 months ago

Subsumed by #908.