Files
SVM/src/SVM.Assembler.Core/Assembler.cs
2025-07-18 12:43:42 +08:00

53 lines
653 B
C#

using LibCLCC.NET.Lexer;
using System;
namespace SVM.Assembler.Core
{
public class Assembler
{
public const string LexDefinition =
@"
Match:
D [0-9]
Number {D}+
InstMath math
InstCvt cvt
InstSystem system
InstSys sys
InstSD sd
Register \${D}+
LabelCode \.code\:
LabelData \.data\:
string "".*""
LineEnd \n
OpAdd add
OpSub sub
OpMul mul
OpDiv div
Id:
InstMath inst
InstCvt inst
InstSystem inst
InstSys inst
InstSD sd
string String
Number Number
Register Register
OpAdd BOp
OpSub BOp
OpMul BOp
OpDiv BOp
LineEnd LE
";
LexerDefinition? definition;
public Assembler()
{
LexerDefinition.TryParse(LexDefinition, out definition);
}
}
}