2 ms·
You can choose to implement it differently based on your implementation language. Data Classes and If statements work really well for this in Python, for exampl
by alabhyajindal 1y ago
You can choose to implement it differently based on your implementation language. Data Classes and If statements work really well for this in Python, for example.
Statement Data Classes: https://github.com/alabhyajindal/plox/blob/main/stmt.py https://github.com/alabhyajindal/plox/blob/main/stmt.py
If statements in the parser matching against them: https://github.com/alabhyajindal/plox/blob/main/parser.py#L38 https://github.com/alabhyajindal/plox/blob/main/parser.py#L3...