awslabs / awslabs/AutoCorrode

Unify syntax translations for shallow embedding of callables

Open
#29 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Isabelle
Stars
105
Forks
27
Avg merge
12h 45m
Merged PRs (30d)
7

Description

It seems that for each of our three(/four?) `urust_callable` grammar entries and each of the ways to call them, we have a separate syntax translation.

For example, these are the syntax translations for a regular function call with arguments (`_urust_funcall_with_args`):

https://github.com/awslabs/AutoCorrode/blob/7bb1e284f9e51bf55dd199301035ee27137ab242/Shallow_Micro_Rust/Micro_Rust_Shallow_Embedding.thy#L299-L306

Note that each one corresponds to an entry in the `_urust_callable` grammar.
For a function call without arguments (`_urust_funcall_no_args`), we have

https://github.com/awslabs/AutoCorrode/blob/7bb1e284f9e51bf55dd199301035ee27137ab242/Shallow_Micro_Rust/Micro_Rust_Shallow_Embedding.thy#L329-L335

with an entry for all `_urust_callable` grammare entries (except `_urust_embed_antiquotation`, which I think never appears without arguments).

It seems to me that these could/should be unified, into a _single_ rule for each of the ways to call a function, and a _single_ rule for each of the ways to shallowly embed the called function. This should improve readability and extensibility.

Contributor guide

Open the contributing guide

Research direction

Read Shallow_Micro_Rust/Micro_Rust_Shallow_Embedding.thy, especially the _urust_funcall_with_args rules around lines 299-306 and _urust_funcall_no_args around 329-335. Compare these with the _urust_callable grammar entries and the shallow-embedding call forms. Done means the duplicated translations are unified while all listed callable forms remain supported.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.