Skip to content

Commit

Permalink
Upgraded GeneticEngine to using Deciders.
Browse files Browse the repository at this point in the history
  • Loading branch information
alcides committed Sep 17, 2024
1 parent ec6ee83 commit bbe7c63
Show file tree
Hide file tree
Showing 4 changed files with 106 additions and 176 deletions.
19 changes: 8 additions & 11 deletions aeon/synthesis_grammar/grammar.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,6 @@ def get_core(self): ...
classType = TypingType[HasGetCore]


def mk_method_core_literal(cls: classType, ty: Type) -> classType:

def get_core(self):
value = getattr(self, "value", None)
return Literal(value, type=ty)

setattr(cls, "get_core", get_core)
return cls


def is_valid_class_name(class_name: str) -> bool:
return class_name not in prelude_ops and not class_name.startswith(("_anf_", "target"))

Expand Down Expand Up @@ -104,7 +94,13 @@ def create_literal_class(
[("value", value_type)],
bases=(parent_class,),
)
return mk_method_core_literal(new_class, aeon_type)

def get_core(self):
value = getattr(self, "value", None)
return Literal(value, type=aeon_type)

setattr(new_class, "get_core", get_core)
return new_class


def create_literals_nodes(type_info: dict[Type, TypingType], types: Optional[list[Type]] = None) -> list[TypingType]:
Expand Down Expand Up @@ -149,6 +145,7 @@ def get_core(_self):

# Note: We cannot use the variable inside Abstraction.
setattr(dc, "get_core", get_core)

return dc


Expand Down
Loading

0 comments on commit bbe7c63

Please sign in to comment.