better representation of ast and tast

This commit is contained in:
Robin Bärtschi 2025-01-23 09:10:29 +01:00
parent 8bb0bb9a4e
commit d998ecfc42
3 changed files with 3 additions and 3 deletions

View File

@ -107,5 +107,5 @@ type BinaryExpression struct {
func (be *BinaryExpression) expressionNode() {}
func (be *BinaryExpression) TokenLiteral() string { return be.Token.Literal }
func (be *BinaryExpression) String() string {
return fmt.Sprintf("%s %s %s", be.Lhs, be.Operator, be.Rhs)
return fmt.Sprintf("%s %s %s", be.Lhs, be.Operator.SymbolString(), be.Rhs)
}

View File

@ -89,5 +89,5 @@ func (be *BinaryExpression) Type() types.Type {
}
func (be *BinaryExpression) TokenLiteral() string { return be.Token.Literal }
func (be *BinaryExpression) String() string {
return fmt.Sprintf("%s %s %s", be.Lhs, be.Operator, be.Rhs)
return fmt.Sprintf("(%s %s %s :> %s)", be.Lhs, be.Operator.SymbolString(), be.Rhs, be.ResultType.Name())
}

View File

@ -1 +1 @@
fn main() = 35 + 34;
fn main() = 3 * 3 / 3 + 1 - 1;