/// <summary> /// Creates a new Event Assembler code language /// </summary> /// <param name="name">Name of the language</param> /// <param name="pointerMaker">Pointer maker for this language</param> /// <param name="pointerList">Pointer list of this langauge, String is the name of the /// label to point to, List are the priorities that are pointed to.</param> /// <param name="pointerListParameters">Array of amount of pointers per POIN code for pointer list.</param> public EACodeLanguage(string name, IPointerMaker pointerMaker, Tuple<string, List<Priority>>[][] pointerList, ICodeTemplateStorer codeStorer, StringComparer stringComparer) { this.name = name; this.codeStorage = codeStorer; //codeStorage.AddCode(new RawCodeTemplate(stringComparer), Priority.low); //codeStorage.AddCode(new CodeFillerTemplate(stringComparer), Priority.low); foreach (ICodeTemplate template in codeStorer) { CodeTemplate template2 = template as CodeTemplate; if (template2 != null) { template2.PointerMaker = pointerMaker; } } reservedWords = new List<string> { offsetChanger, //Offset changing code alignOffset, //Offset aligning code currentOffset, //Referances current offset messagePrinter, //Print message to message box/something errorPrinter, //Print message to message box/something warningPrinter //Print message to message box/something }; this.assembler = new EAExpressionAssembler(codeStorage, null); this.disassembler = new EACodeLanguageDisassembler( codeStorage, pointerMaker, pointerList); }
public EACodeLanguageAssembler( ICodeTemplateStorer codeStorage, IEnumerable<string> reservedWords, StringComparer stringComparer) { this.codeStorage = codeStorage; this.reservedWords = reservedWords; SetBuiltInCodes(stringComparer); }
public EACodeLanguageAssembler( ICodeTemplateStorer codeStorage, IEnumerable <string> reservedWords, StringComparer stringComparer) { this.codeStorage = codeStorage; this.reservedWords = reservedWords; SetBuiltInCodes(stringComparer); }
public EACodeLanguageDisassembler( ICodeTemplateStorer codeStorage, IPointerMaker pointerMaker, Tuple<string, List<Priority>>[][] pointerList) { this.codeStorage = codeStorage; this.pointerMaker = pointerMaker; this.pointerList = pointerList; //longestTemplate = (from template in codeStorage // where template is CodeTemplate // select (template as CodeTemplate).Length).Max(); }
public EAExpressionAssembler(ICodeTemplateStorer storer, IParser <Token, IExpression <T> > parser, IIntegerType <T> intType, IPointerMaker <T> pointerMaker) { this.parser = parser; this.storer = storer; this.intType = intType; this.pointerMaker = pointerMaker; this.stringComparison = StringComparison.OrdinalIgnoreCase; firstPassHandlers = new Dictionary <EAExpressionType, Func <IExpression <T>, AssemblyContext <T>, FirstPassResult> >(); firstPassHandlers[EAExpressionType.Code] = HandleCodeFirstPass; firstPassHandlers[EAExpressionType.Scope] = HandleScopeFirstPass; firstPassHandlers[EAExpressionType.Labeled] = HandleLabelFirstPass; firstPassHandlers[EAExpressionType.Assignment] = HandleAssignmentFirstPass; secondPassHandlers = new Dictionary <EAExpressionType, Action <IExpression <T>, AssemblyContext <T> > >(); secondPassHandlers[EAExpressionType.Code] = HandleCodeSecondPass; secondPassHandlers[EAExpressionType.Scope] = HandleScopeSecondPass; secondPassHandlers[EAExpressionType.Labeled] = HandleLabelSecondPass; secondPassHandlers[EAExpressionType.Assignment] = HandleAssignmentSecondPass; }
/// <summary> /// Creates a new Event Assembler code language /// </summary> /// <param name="name">Name of the language</param> /// <param name="pointerMaker">Pointer maker for this language</param> /// <param name="pointerList">Pointer list of this langauge, String is the name of the /// label to point to, List are the priorities that are pointed to.</param> /// <param name="pointerListParameters">Array of amount of pointers per POIN code for pointer list.</param> public EACodeLanguage(string name, IPointerMaker <int> pointerMaker, Tuple <string, List <Priority> >[][] pointerList, ICodeTemplateStorer codeStorer, StringComparer stringComparer) { this.name = name; this.codeStorage = codeStorer; //codeStorage.AddCode(new RawCodeTemplate(stringComparer), Priority.low); //codeStorage.AddCode(new CodeFillerTemplate(stringComparer), Priority.low); //foreach (ICodeTemplate template in codeStorer) //{ // CodeTemplate template2 = template as CodeTemplate; // if (template2 != null) // { // template2.PointerMaker = pointerMaker; // } //} reservedWords = new List <string> { offsetChanger, //Offset changing code alignOffset, //Offset aligning code currentOffset, //Referances current offset messagePrinter, //Print message to message box/something errorPrinter, //Print message to message box/something warningPrinter //Print message to message box/something }; var pres = new IntRepresentation(); this.assembler = new EAExpressionAssembler <int>( codeStorage, new TokenParser <int>(StringExtensions.GetValue), new IntRepresentation(), pointerMaker); this.disassembler = new EACodeLanguageDisassembler <int>( codeStorage, pointerMaker, pointerList, pres); }
/// <summary> /// Creates a new Event Assembler code language /// </summary> /// <param name="name">Name of the language</param> /// <param name="pointerMaker">Pointer maker for this language</param> /// <param name="pointerList">Pointer list of this langauge, String is the name of the /// label to point to, List are the priorities that are pointed to.</param> /// <param name="pointerListParameters">Array of amount of pointers per POIN code for pointer list.</param> public EACodeLanguage(string name, IPointerMaker<int> pointerMaker, Tuple<string, List<Priority>>[][] pointerList, ICodeTemplateStorer codeStorer, StringComparer stringComparer) { this.name = name; this.codeStorage = codeStorer; //codeStorage.AddCode(new RawCodeTemplate(stringComparer), Priority.low); //codeStorage.AddCode(new CodeFillerTemplate(stringComparer), Priority.low); //foreach (ICodeTemplate template in codeStorer) //{ // CodeTemplate template2 = template as CodeTemplate; // if (template2 != null) // { // template2.PointerMaker = pointerMaker; // } //} reservedWords = new List<string> { offsetChanger, //Offset changing code alignOffset, //Offset aligning code currentOffset, //Referances current offset messagePrinter, //Print message to message box/something errorPrinter, //Print message to message box/something warningPrinter //Print message to message box/something }; var pres = new IntRepresentation(); this.assembler = new EAExpressionAssembler<int>( codeStorage, new TokenParser<int>(StringExtensions.GetValue), new IntRepresentation(), pointerMaker); this.disassembler = new EACodeLanguageDisassembler<int>( codeStorage, pointerMaker, pointerList, pres); }
public EACodeLanguage(string name, IPointerMaker pointerMaker, Tuple <string, List <Priority> >[][] pointerList, ICodeTemplateStorer codeStorer, StringComparer stringComparer) { this.name = name; this.codeStorage = codeStorer; foreach (ICodeTemplate codeTemplate1 in (IEnumerable <ICodeTemplate>)codeStorer) { CodeTemplate codeTemplate2 = codeTemplate1 as CodeTemplate; if (codeTemplate2 != null) { codeTemplate2.PointerMaker = pointerMaker; } } this.reservedWords = new List <string>() { offsetChanger, alignOffset, currentOffset, messagePrinter, errorPrinter, warningPrinter, pushOffset, popOffset, assertion, protectCode }; this.assembler = new EAExpressionAssembler(this.codeStorage, (IParser <Token, IExpression <int> >)null); this.disassembler = new EACodeLanguageDisassembler(this.codeStorage, pointerMaker, pointerList); }
public EACodeLanguageDisassembler(ICodeTemplateStorer codeStorage, IPointerMaker pointerMaker, Tuple <string, List <Priority> >[][] pointerList) { this.codeStorage = codeStorage; this.pointerMaker = pointerMaker; this.pointerList = pointerList; }
public EAExpressionAssembler(ICodeTemplateStorer storer, IParser <Token, IExpression <int> > parser) { this.parser = parser; this.storer = storer; }