jackfiled
bd3db1b7b7
增加语法分析基类和状态转换接口抽象,为直接生成语法分析器做准备,同时也提前释放一些大对象,降低内存消耗。 Reviewed-on: PostGuard/Canon#8
27 lines
685 B
C#
27 lines
685 B
C#
using Canon.Core.GrammarParser;
|
|
|
|
namespace Canon.Core.Abstractions;
|
|
|
|
/// <summary>
|
|
/// 进行归约需要的信息
|
|
/// </summary>
|
|
/// <param name="Length">归约的长度</param>
|
|
/// <param name="Left">归约得到的左部符号</param>
|
|
public record ReduceInformation(int Length, NonTerminator Left);
|
|
|
|
/// <summary>
|
|
/// 状态的各种迁移信息
|
|
/// </summary>
|
|
public interface ITransformer
|
|
{
|
|
/// <summary>
|
|
/// 进行移进的信息
|
|
/// </summary>
|
|
public IDictionary<TerminatorBase, ITransformer> ShiftTable { get; }
|
|
|
|
/// <summary>
|
|
/// 进行归约的信息
|
|
/// </summary>
|
|
public IDictionary<Terminator, ReduceInformation> ReduceTable { get; }
|
|
}
|