Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pancake array support #1039

Open
JunmingZhao42 opened this issue Aug 8, 2024 · 1 comment
Open

Pancake array support #1039

JunmingZhao42 opened this issue Aug 8, 2024 · 1 comment

Comments

@JunmingZhao42
Copy link

As discussed it might be a good idea to support c-like arrays in pancake. For example

var arr_ptr = @base;
var offset = 4 * 8;
stw arr_ptr + offset, 42;
var x = lds 1 arr_ptr + offset;

can be written as

var arr_ptr = @base;
arr_ptr[4] = 42;
var x = arr_ptr[4];

That'll certainly make implementation easier and benefit code readability. And potentially also make it easier to translate to ATP intermediate language like silver.

@mktnk3 mktnk3 added the Pancake label Aug 9, 2024
@myreen
Copy link
Contributor

myreen commented Aug 9, 2024

This would be fine by me, as long as this feature doesn't invent or just hijack the name offset. Perhaps the example code could just expand to:

var arr_ptr = @base;
stw arr_ptr + 4 * 8, 42;
var x = lds 1 arr_ptr + 4 * 8;

One minor comment: the 8 in 4 * 8 is assuming this is code for a 64-bit architecture. I would like Pancake to have a @bytes_in_word (or @word_size) expression in the concrete syntax. This expression should expand to the value of the HOL constant bytes_in_word, which is 4 for 32-bit and 8 for 64-bit architectures. Having such a constant in Pancake concrete syntax makes it possible to write target-independent Pancake code.

@mn200 mn200 added this to the Pancake Syntactic Sugar milestone Aug 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants