~kf5jwc/imp-parser

ref: 9a694fa0d8b73f01beb051b54cdab8a2b000be09 imp-parser/imp_parser/ast/types.py -rw-r--r-- 645 bytes View raw
9a694fa0 — Kyle Jones I've done more type annotating, which.... helped? 1 year, 6 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from typing import Union
from ..parser import Result


class Equality(object):
    def __eq__(self, other) -> bool:
        return isinstance(other, self.__class__) and \
               self.__dict__ == other.__dict__

    def __ne__(self, other) -> bool:
        return not self.__eq__(other)


# "A"rithmetic "exp"ression
class Aexp(Equality):

    def eval(self, env: dict) -> int:
        raise NotImplementedError


# "B"oolean "exp"ression
class Bexp(Equality):

    def eval(self, env: dict) -> bool:
        raise NotImplementedError


class Statement(Equality):

    def eval(self, env: dict) -> None:
        raise NotImplementedError