zkay.compiler.privacy.circuit_generation.name_factory

Module Contents

class zkay.compiler.privacy.circuit_generation.name_factory.BaseNameFactory(base_name: str)

A Base name factory can generate fresh, unused name strings with a given prefix

get_new_name(self, t: zkay.zkay_ast.ast.TypeName, inc=False) str

Generate a fresh name for a value of type t.

Parameters
  • t – transformed type

  • inc – if True, the internal counter, which is used as part of fresh ids, is incremented

class zkay.compiler.privacy.circuit_generation.name_factory.NameFactory(base_name: str, arg_type: zkay.zkay_ast.ast.HybridArgType)

Bases: BaseNameFactory

A Name factory can generate fresh, unused HybridArgumentIdfs with a given prefix.

get_new_idf(self, t: zkay.zkay_ast.ast.TypeName, priv_expr: Optional[zkay.zkay_ast.ast.Expression] = None) zkay.zkay_ast.ast.HybridArgumentIdf

Generate a new HybridArgumentIdf which references priv_expr and has transformed type t.

add_idf(self, name: str, t: zkay.zkay_ast.ast.TypeName, priv_expr: Optional[zkay.zkay_ast.ast.Expression] = None)

Generate a new HybridArgumentIdf with the given name.

This also adds the HybridArgumentIdf to the internal list of identifiers generated by this NameFactory.