Skip to content

Commit 2a55983

Browse files
authored
feat: Add exponentiation operator to CSEMachine (#32)
The code changes add support for the exponentiation operator (`**`) in the `CSEMachine` class. This allows for performing exponentiation calculations in the interpreter.
1 parent 2ae75fd commit 2a55983

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/interpreter/cse_machine/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,7 @@ def exitEnv(self, env_marker):
280280
"+": lambda rator, rand: rator + rand,
281281
"-": lambda rator, rand: rator - rand,
282282
"*": lambda rator, rand: rator * rand,
283+
"**": lambda rator, rand: rator ** rand,
283284
"/": lambda rator, rand: int(rator / rand),
284285
"or": lambda rator, rand: rator or rand,
285286
"&": lambda rator, rand: rator and rand,

0 commit comments

Comments
 (0)