From 49227111da0f92822c132dce8c66168ad60d78ef Mon Sep 17 00:00:00 2001 From: "Tristan B. Kildaire" Date: Fri, 16 Apr 2021 22:17:17 +0200 Subject: [PATCH] Set import to public to expose to others importing this module --- source/tlang/compiler/symbols/data.d | 69 +------------------ source/tlang/compiler/symbols/expressions.d | 75 +++++++++++++++++++++ 2 files changed, 76 insertions(+), 68 deletions(-) create mode 100644 source/tlang/compiler/symbols/expressions.d diff --git a/source/tlang/compiler/symbols/data.d b/source/tlang/compiler/symbols/data.d index 5091e752..e6404c25 100644 --- a/source/tlang/compiler/symbols/data.d +++ b/source/tlang/compiler/symbols/data.d @@ -311,79 +311,12 @@ public class Variable : TypedEntity /* Code gen */ } -public class Expression : Statement -{ - import compiler.typecheck.core; - /* TODO: Takes in symbol table? */ - public string evaluateType(TypeChecker typechecker, Container c) - { - /* TODO: Go through here evaluating the type */ - return null; - } - - this() - { - - } - - /* TODO: Evalute this expression's type */ -} +public import compiler.symbols.expressions; -/* TODO: Look into arrays later */ -public class StringExpression : Expression -{ - private string ztring; - this(string ztring) - { - this.ztring = ztring; - } -} - -public class OperatorExpression : Expression -{ - /* Operator */ - private SymbolType operator; - - this(SymbolType operator) - { - this.operator = operator; - } -} - -public class UnaryOperatorExpression : OperatorExpression -{ - private Expression exp; - - this(SymbolType operator, Expression exp) - { - super(operator); - this.exp = exp; - } -} - -public class BinaryOperatorExpression : OperatorExpression -{ - /* TODO: Take in operator */ - this(SymbolType operator, Expression lhs, Expression rhs) - { - super(operator); - } -} - -public class NumberLiteral : Expression -{ - private string numberLiteral; - - /* TODO: Take in info like tyoe */ - this(string numberLiteral) - { - this.numberLiteral = numberLiteral; - } -} public class VariableAssignment { diff --git a/source/tlang/compiler/symbols/expressions.d b/source/tlang/compiler/symbols/expressions.d new file mode 100644 index 00000000..4dc0bd54 --- /dev/null +++ b/source/tlang/compiler/symbols/expressions.d @@ -0,0 +1,75 @@ +module compiler.symbols.expressions; + +import compiler.symbols.data; + +/* TODO: Look into arrays later */ +public class StringExpression : Expression +{ + private string ztring; + + this(string ztring) + { + this.ztring = ztring; + } +} + +public class OperatorExpression : Expression +{ + /* Operator */ + private SymbolType operator; + + this(SymbolType operator) + { + this.operator = operator; + } +} + +public class UnaryOperatorExpression : OperatorExpression +{ + private Expression exp; + + this(SymbolType operator, Expression exp) + { + super(operator); + this.exp = exp; + } +} + +public class BinaryOperatorExpression : OperatorExpression +{ + /* TODO: Take in operator */ + this(SymbolType operator, Expression lhs, Expression rhs) + { + super(operator); + } +} + +public class NumberLiteral : Expression +{ + private string numberLiteral; + + /* TODO: Take in info like tyoe */ + this(string numberLiteral) + { + this.numberLiteral = numberLiteral; + } +} + +public class Expression : Statement +{ + import compiler.typecheck.core; + /* TODO: Takes in symbol table? */ + public string evaluateType(TypeChecker typechecker, Container c) + { + /* TODO: Go through here evaluating the type */ + + return null; + } + + this() + { + + } + + /* TODO: Evalute this expression's type */ +} \ No newline at end of file