anoma / vamp-ir

Vamp-IR is a proof-system-agnostic language for writing arithmetic circuits
https://anoma.github.io/VampIR-Book/
Apache License 2.0
156 stars 44 forks source link

Use trait to define backend #114

Open lopeetall opened 1 year ago

lopeetall commented 1 year ago

Addressing

This PR includes a definition of a BackendCompiler trait, and the trait is implemented for the Plonk backend.

The BackendCompiler trait requires functions which take the base cases of three-address code operations (e.g. var + const = var) and adds them to a circuit. Operations which can be derived from the base cases algebraically do not nee to be implemented (e.g. var - const = var can be derived from the earlier case).

Only base-case arithmetic operations are required by the trait at the moment.

Marked as draft until the Halo2 backend is implemented as a BackendCompiler.