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,27 +0,0 @@
|
|||
using System;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace Compiler
|
||||
{
|
||||
public class Pattern
|
||||
{
|
||||
private String pattern;
|
||||
private TokenType tokenType;
|
||||
|
||||
public Pattern(String pattern, TokenType tokenType)
|
||||
{
|
||||
this.pattern = pattern;
|
||||
this.tokenType = tokenType;
|
||||
}
|
||||
|
||||
public Regex ToRegex()
|
||||
{
|
||||
return new Regex(this.pattern);
|
||||
}
|
||||
|
||||
public TokenType GetTokenType()
|
||||
{
|
||||
return this.tokenType;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue