public TermExpression( Token start, Expression left, Keyword oper, Expression right) : base(start) { this.Left = left; this.Operator = oper; this.Right = right; }
public VariableDeclaration( Token start, IEnumerable<string> variableNames, TypeReference type, Expression initExpression) : base(start) { this.type = type; this.variableNames.AddRange(variableNames); this.InitExpression = initExpression; }
public ClassDeclaration( Token start, string name, string baseType, bool isStatic, bool isPublic) : base(start, name) { this.IsPublic = isPublic; this.IsStatic = isStatic; this.BaseType = baseType; }
public MethodDeclaration( Token start, string name, bool isStatic, bool isVirtual, bool isAbstract) : base(start) { this.MethodName = name; this.IsStatic = isStatic; this.IsVirtual = isVirtual; this.IsAbstract = isAbstract; }
private bool TryEmitAllocCall(Token start, CompilerContext context, Scope scope, MethodImpl method, int size) { TypeDefinition memoryType = null; if (!this.TryFindSystemMemory(start, context, out memoryType)) { return false; } MethodInfo allocMethod = memoryType.Methods.FirstOrDefault(e => string.CompareOrdinal("Alloc", e.Name) == 0); if (allocMethod == null) { log.Write(new Message( start.Path, start.Line, start.Column, Severity.Error, Properties.Resources.CodeGenerator_SystemMemoryMissingAlloc)); return false; } method.Module.AddProto(allocMethod); method.Statements.Add(new AsmStatement { Instruction = "mov eax," + size.ToString() }); method.Statements.Add(new AsmStatement { Instruction = "push eax" }); method.Statements.Add(new AsmStatement { Instruction = "call " + allocMethod.MangledName }); method.Statements.Add(new AsmStatement { Instruction = "add esp,4" }); return true; }
public NewExpression(Token start, TypeReference typeReference, IEnumerable<Expression> constructorArguments) : base(start) { this.typeReference = typeReference; this.constructorArguments.AddRange(constructorArguments); }
private bool TryFindSystemMemory(Token start, CompilerContext context, out TypeDefinition memoryType) { if (!context.TryFindTypeByName("System.Memory", out memoryType)) { log.Write(new Message( start.Path, start.Line, start.Column, Severity.Error, Properties.Resources.CodeGenerator_SystemMemoryNotDeclared)); return false; } return true; }
protected ParseNode(Token start) { this.start = start; }
public BlockStatement(Token start) : base(start) { }
public PointerTypeReference(Token start, TypeReference elementType) : base(start) { this.ElementType = elementType; }
public ParameterDeclaration(Token start, IEnumerable<string> parameterNames, TypeReference type) : base(start) { this.type = type; this.parameterNames.AddRange(parameterNames); }
public WhileStatement(Token start) : base(start) { }
public ArrayTypeReference(Token start, Expression elementCount, TypeReference elementType) : base(start) { this.ElementCount = elementCount; this.ElementType = elementType; }
protected ReferenceExpression(Token start) : base(start) { }
private bool TryEmitFreeCall(Token start, CompilerContext context, Scope scope, MethodImpl method) { TypeDefinition memoryType = null; if (!this.TryFindSystemMemory(start, context, out memoryType)) { return false; } MethodInfo freeMethod = memoryType.Methods.FirstOrDefault(e => string.CompareOrdinal(e.Name, "Free") == 0); if (freeMethod == null) { log.Write(new Message( start.Path, start.Line, start.Column, Severity.Error, Properties.Resources.CodeGenerator_SystemMemoryMissingFree)); return false; } method.Module.AddProto(freeMethod); method.Statements.Add(new AsmStatement { Instruction = string.Format("call {0}", freeMethod.MangledName) }); return true; }
public NamedReferenceExpression(Token start, string identifier) : base(start) { this.Identifier = identifier; }
public MemberReferenceExpression(Token start, ReferenceExpression inner, string memberName) : base(start) { this.MemberName = memberName; this.Inner = inner; }
public ArrayIndexReferenceExpression(Token start, ReferenceExpression inner, Expression index) : base(start) { this.Inner = inner; this.Index = index; }
public InheritedReferenceExpression(Token start) : base(start) { }
public AssignmentStatement(Token start, ReferenceExpression storage, Expression value) : base(start) { this.Value = value; this.Storage = storage; }
public AddressExpression(Token start, ReferenceExpression inner) : base(start) { this.Inner = inner; }
public IfStatement(Token start) : base(start) { }
protected Expression(Token start) : base(start) { }
protected TypeDeclaration(Token start, string name) : base(start) { this.Name = name; }
public NamedTypeReference(Token start, string typeName) : base(start) { this.TypeName = typeName; }
public CallStatement(Token start, ReferenceExpression callExpression) : base(start) { this.Expression = callExpression; }
protected TypeReference(Token start) : base(start) { }
public NotExpression(Token start, Expression inner) : base(start) { this.Inner = inner; }
public LiteralExpression(Token start, object value) : base(start) { this.Value = value; }
public ProgramUnit(Token start) : base(start) { }