Skip to content

Commit

Permalink
Functions are now supported but without arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
TENTHER101 committed May 14, 2024
1 parent 5cfbd4d commit 67408ef
Show file tree
Hide file tree
Showing 13 changed files with 4,104 additions and 3,950 deletions.
5 changes: 5 additions & 0 deletions example-4.tepl
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
function add means
output 5+5
end

call add
Binary file modified src/__pycache__/lexer.cpython-310.pyc
Binary file not shown.
Binary file modified src/__pycache__/nodes.cpython-310.pyc
Binary file not shown.
Binary file modified src/__pycache__/parser.cpython-310.pyc
Binary file not shown.
Binary file modified src/__pycache__/parsetab.cpython-310.pyc
Binary file not shown.
Binary file modified src/__pycache__/transpiler.cpython-310.pyc
Binary file not shown.
3 changes: 2 additions & 1 deletion src/lexer.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@
'OF': 'OF',
'FIND': 'FIND',
'OCCURENCES': 'OCCURENCES',
'CONVERT': 'CONVERT'
'CONVERT': 'CONVERT',
'CALL': 'CALL'
}

# Regular expression rules for tokens
Expand Down
2 changes: 1 addition & 1 deletion src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from gui import run
from transpiler import transpile

__version__ = 'v1.95.55'
__version__ = 'v1.97.00'
__mode__ = 'execute' # 'execute' | 'transpile'|'parse'|'tokenize'


Expand Down
13 changes: 13 additions & 0 deletions src/nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,3 +282,16 @@ def __init__(self, expr, to_type):

def __repr__(self):
return f"Convert({self.expr} {self.to_type})"


class Call(Stmt):
def __init__(self, name: Identifier, args=None):
self.type = "call"
self.name = name
self.args = args

def __repr__(self):
if self.args is None:
return f"Call({self.name})"
else:
return f"Call({self.name} {self.args})"

0 comments on commit 67408ef

Please sign in to comment.