Skip to content

Commit

Permalink
Add a type checker to the parser
Browse files Browse the repository at this point in the history
The current implementation lacks advanced type checking (it does not
keep track of variable or function types at all) but the unification
algoritm is working and it can be used for literal expressions. The
error reporting is still somewhat crude, the checker doesn't use the
information in the block JSON files and overall the code has to be
cleaned though.
  • Loading branch information
jmi2k committed Jun 13, 2020
1 parent 26af4ed commit 531758c
Show file tree
Hide file tree
Showing 2 changed files with 187 additions and 34 deletions.
8 changes: 4 additions & 4 deletions learnbot_dsl/learnbotCode/LearnBlock.py
Expand Up @@ -926,14 +926,14 @@ def formatError(error):
start = error['from']
end = error['to']

if (start == None and end == None):
if start == None and end == None:
spanMsg = "somewhere"
elif (end == None):
elif end == None:
spanMsg = f"from {start[0]}:{start[1]}"
elif (start == end):
elif start == end:
spanMsg = f"at {start[0]}:{start[1]}"
else:
spanMsg = f"from {start[0]}:{start[1]} to {end[0]}{end[1]}"
spanMsg = f"from {start[0]}:{start[1]} to {end[0]}:{end[1]}"

return f"{level}: {message} ({spanMsg})"

Expand Down

0 comments on commit 531758c

Please sign in to comment.