lexing and parsing unary operators
This commit is contained in:
parent
b2c2a2f497
commit
202c1d2ca2
21 changed files with 290 additions and 130 deletions
|
|
@ -5,6 +5,7 @@ namespace Compiler.Parser.Nodes
|
|||
ProgramNode,
|
||||
FunctionNode,
|
||||
ReturnStatementNode,
|
||||
ExpressionNode
|
||||
ExpressionNode,
|
||||
|
||||
}
|
||||
}
|
||||
10
Compiler/Parser/Nodes/OperatorType.cs
Normal file
10
Compiler/Parser/Nodes/OperatorType.cs
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
namespace Compiler.Parser.Nodes
|
||||
{
|
||||
public enum OperatorType
|
||||
{
|
||||
//unary operators
|
||||
Negation,
|
||||
BitwiseComplement,
|
||||
LogicalNegation,
|
||||
}
|
||||
}
|
||||
14
Compiler/Parser/Nodes/UnaryOperatorNode.cs
Normal file
14
Compiler/Parser/Nodes/UnaryOperatorNode.cs
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
namespace Compiler.Parser.Nodes
|
||||
{
|
||||
public sealed class UnaryOperatorNode : Node
|
||||
{
|
||||
public override NodeType NodeType { get; set; }
|
||||
public OperatorType OperatorType { get; set; }
|
||||
|
||||
public UnaryOperatorNode(OperatorType operatorType)
|
||||
{
|
||||
OperatorType = operatorType;
|
||||
NodeType = NodeType.ExpressionNode;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue