Added Parser
- can parse a basic token list to an AST
This commit is contained in:
parent
ea26acce4a
commit
b3fe78fffb
19 changed files with 451 additions and 88 deletions
|
|
@ -1,28 +0,0 @@
|
|||
using System;
|
||||
|
||||
namespace Compiler
|
||||
{
|
||||
public class Token
|
||||
{
|
||||
public TokenType TokenType { get; set; }
|
||||
public String Value { get; set; }
|
||||
public int Length { get; set; }
|
||||
|
||||
public Token(TokenType pTokenType)
|
||||
{
|
||||
this.TokenType = pTokenType;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
if (Value == null)
|
||||
{
|
||||
return TokenType.ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
return TokenType.ToString() + ":" + Value.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue