Initial commit - fix problems & refactor code

This commit is contained in:
2025-12-22 19:10:46 +03:00
commit ff36917cb5
39 changed files with 1499 additions and 0 deletions
+22
View File
@@ -0,0 +1,22 @@
from core.tokens import (
SpecialForm,
BinaryOperator,
BinaryPredicate
)
from core.primitives.symbol import symbol
def parseToken(token: str):
for en in [SpecialForm, BinaryOperator, BinaryPredicate]:
if token in en:
return en(token)
if token in ['true', 'false']:
return token == 'true'
try:
return int(token)
except ValueError:
if token == 'inf':
return symbol(token)
try:
return float(token)
except ValueError:
return symbol(token)