-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(interpreter) Make operand type checks be compile-time errors
- Loading branch information
Showing
24 changed files
with
572 additions
and
489 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using Perlang.Interpreter.Extensions; | ||
using static Perlang.Utils; | ||
|
||
namespace Perlang.Interpreter; | ||
|
||
public static class InterpreterMessages | ||
{ | ||
public static string UnsupportedOperandTypes(TokenType operatorType, object left, object right) => | ||
$"Unexpected runtime error: Unsupported {operatorType.ToSourceString()} operands specified: {StringifyType(left)} and {StringifyType(right)}"; | ||
|
||
public static string UnsupportedOperatorTypeInBinaryExpression(TokenType operatorType) => | ||
$"Internal error: Unsupported operator {operatorType.ToSourceString()} in binary expression."; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#nullable enable | ||
using Perlang.Extensions; | ||
using Perlang.Interpreter.Extensions; | ||
|
||
namespace Perlang.Interpreter.Typing; | ||
|
||
internal static class Messages | ||
{ | ||
public static string UnsupportedOperandTypes(TokenType operatorType, ITypeReference leftTypeReference, ITypeReference rightTypeReference) => | ||
$"Unsupported {operatorType.ToSourceString()} operand types: " + | ||
$"'{leftTypeReference.ClrType.ToTypeKeyword()}' and '{rightTypeReference.ClrType.ToTypeKeyword()}'"; | ||
} |
Oops, something went wrong.