Created
December 13, 2020 19:55
-
-
Save gidgid/abd4a780a233b822266348b863a728c9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from dataclasses import dataclass | |
class Expression: | |
"""Represents an ADT expression""" | |
@dataclass | |
class Literal(Expression): | |
value: int | |
@dataclass | |
class Add(Expression): | |
x: Expression | |
y: Expression | |
@dataclass | |
class Subtract(Expression): | |
x: Expression | |
y: Expression | |
@dataclass | |
class Multiply(Expression): | |
x: Expression | |
y: Expression | |
@dataclass | |
class Divide(Expression): | |
x: Expression | |
y: Expression |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment