public DogePropertyDefinition(DogeIdentifier name, DogeMemberAccessExpression type, DogeAccessibilityModifier modifier, DogeNamelessMethodDefinition?get, DogeNamelessMethodDefinition?set, DogeFile file, Range <int> tokenRange) : base(file, tokenRange) { name.Parent = this; NameIdentifier = name; Name = name.Name; type.Parent = this; TypeIdentifier = type; Type = type.ToName(); Modifier = modifier; if (get != null) { get.Parent = this; } Get = get; if (set != null) { set.Parent = this; } Set = set; }
public DogeReturnStatement(DogeNode?value, DogeFile file, Range <int> range) : base(file, range) { if (value != null) { value.Parent = this; } Value = value; }
public DogeWhileStatement(DogeNode condition, DogeNode body, DogeFile file, Range <int> range) : base(file, range) { condition.Parent = this; Condition = condition; body.Parent = this; Body = body; }
public DogeUnaryExpression(DogeUnaryOperator unaryOperator, DogeNode internalExpression, DogeFile file, Range <int> tokenRange) : base(file, tokenRange) { UnaryOperator = unaryOperator; internalExpression.Parent = this; InternalExpression = internalExpression; }
public DogeBinaryExpression(DogeBinaryOperator binaryOperator, DogeNode leftHandSide, DogeNode rightHandSide, DogeFile file) : base(file, Range<int>.ConcatOrdered(leftHandSide.TokenRange, rightHandSide.TokenRange)) { BinaryOperator = binaryOperator; leftHandSide.Parent = this; LeftHandSide = leftHandSide; rightHandSide.Parent = this; RightHandSide = rightHandSide; }
private static void Main() { Workspace = DogeWorkspace.Create(); DogeFile file = DogeFile.Console; Compile(file, false, File.ReadAllText("TestCode.dpp"), "Test", "Program", "Main"); while (true) { Console.Write("\n> "); string code = Console.ReadLine(); Compile(file, false, code, "Program", "Main"); } }
public DogeFieldDefinition(DogeIdentifier name, DogeMemberAccessExpression type, DogeAccessibilityModifier modifier, bool isReadonly, DogeNode initialValue, DogeFile file, Range <int> tokenRange) : this( name, type, modifier, isReadonly, file, tokenRange) { initialValue.Parent = this; InitialValue = initialValue; }
public DogeFieldDefinition(DogeIdentifier name, DogeMemberAccessExpression type, DogeAccessibilityModifier modifier, bool isReadonly, DogeFile file, Range <int> tokenRange) : base(file, tokenRange) { name.Parent = this; NameIdentifier = name; Name = name.Name; type.Parent = this; TypeIdentifier = type; Type = type.ToName(); Modifier = modifier; IsReadonly = isReadonly; }
public DogeIfStatement( DogeNode condition, DogeNode body, DogeNode? @else, DogeFile file, Range <int> tokenRange) : base(file, tokenRange) { condition.Parent = this; Condition = condition; body.Parent = this; Body = body; if (@else != null) { @else.Parent = this; } Else = @else; }
private static void Compile(DogeFile file, bool verbose, string code, params string[] startup) { IEnumerable <DogeToken> tokens = Workspace.Tokenize(code).ToArray(); if (verbose) { Console.WriteLine($"{string.Join(",\n", tokens.Select(x => x.ToString()))}"); } DogeNamespaceDefinition @namespace = Workspace.Build(file, tokens); if (verbose) { Console.Write(@namespace.ToString()); } DogeSymbolTable symbolTable = Workspace.BuildSymbolTable(@namespace); if (verbose) { Console.Write(symbolTable); } Workspace.AddStandardLibrary(symbolTable); Workspace.ResolveSymbols(@namespace, symbolTable); if (verbose) { Console.Write(@namespace.ToString()); } DogeProject project = new DogeProject( @namespace, (DogeNamedMethodDefinition)symbolTable.ResolveSymbol( startup, s => s.SymbolType == DogeSymbolType.Method, _ => true) .Definition !); DogeInterpreter interpreter = new DogeInterpreter(project); interpreter.Run(); }
public DogePropertyDefinition(DogeIdentifier name, DogeMemberAccessExpression type, DogeAccessibilityModifier modifier, DogeNamelessMethodDefinition?get, DogeNamelessMethodDefinition?set, DogeNode?initialValue, DogeFile file, Range <int> tokenRange) : this( name, type, modifier, get, set, file, tokenRange) { if (initialValue != null) { initialValue.Parent = this; } InitialValue = initialValue; }
public DogeLiteral(TContent content, DogeFile file, Range <int> tokenRange) : base(file, tokenRange) { Content = content; }
public DogeNamelessMethodDefinition(DogeMemberAccessExpression returnType, ICollection <DogeParameterDefinition> parameters, DogeStatementList statementList, DogeFile file, Range <int> tokenRange) : base(file, tokenRange) { returnType.Parent = this; ReturnTypeIdentifier = returnType; ReturnType = returnType.ToName(); parameters.ForEach(x => x.Parent = this); Parameters = parameters; statementList.Parent = this; MethodBody = statementList; }
public DogeListExpression(ICollection <T> elements, DogeFile file, Range <int> tokenRange) : base(file, tokenRange) { elements.ForEach(x => x.Parent = this); Elements = elements; }
public DogeNamespaceDefinition(DogeMemberAccessExpression name, ICollection <DogeUsingDefinition> usingDefinitions, ICollection <DogeClassDefinition> classDefinitions, ICollection <DogeNamespaceDefinition> nestedNamespaces, DogeFile file, Range <int> tokenRange) : base(file, tokenRange) { name.Parent = this; NameIdentifier = name; Name = name.ToName(); usingDefinitions.ForEach(x => x.Parent = this); UsingDefinitions = usingDefinitions; nestedNamespaces.ForEach(x => x.Parent = this); NestedNamespaces = nestedNamespaces; classDefinitions.ForEach(x => x.Parent = this); ClassDefinitions = classDefinitions; }
public DogeSymbolNode(DogeSymbol symbol, DogeFile file, Range <int> tokenRange) : base(file, tokenRange) { Symbol = symbol; }
public DogeMethodCallStatement(DogeIdentifier name, bool isSafeAccess, bool isPrintAccess, DogeNode?returnType, DogeParametersExpression callParameters, DogeFile file, Range <int> range) : base(name, isSafeAccess, isPrintAccess, file, range) { callParameters.Parent = this; CallParameters = callParameters; ReturnType = returnType; }
public DogeMemberAccessorExpression(DogeIdentifier name, bool isSafeAccess, bool isPrintAccess, DogeFile file, Range <int> tokenRange) : base(file, tokenRange) { name.Parent = this; NameIdentifier = name; Name = name.Name; IsSafeAccess = isSafeAccess; IsPrintAccess = isPrintAccess; }
public DogeNamespaceDefinition Build(DogeFile file, IEnumerable <DogeToken> tokens) => new DogeParser(file, tokens).Parse();
public DogeNamespaceDefinition Build(DogeFile file, string code) => Build(file, Tokenize(code));
public DogeStatementList(ICollection <DogeNode> statements, DogeFile file, Range <int> tokenRange) : base(file, tokenRange) { statements.ForEach(s => s.Parent = this); Statements = statements; }
public DogeUsingDefinition(DogeMemberAccessExpression referenceName, DogeFile file, Range <int> tokenRange) : base(file, tokenRange) { referenceName.Parent = this; ReferenceNameIdentifier = referenceName; ReferenceName = referenceName.ToName(); }
public DogeLocalDeclarationStatement(DogeIdentifier name, DogeMemberAccessExpression type, DogeNode?value, DogeFile file, Range <int> range) : base(file, range) { name.Parent = this; NameIdentifier = name; Name = name.Name; type.Parent = this; TypeIdentifier = type; Type = type.ToName(); if (value != null) { value.Parent = this; } Value = value; }
public DogeParameterDefinition(DogeMemberAccessExpression type, DogeIdentifier name, DogeFile file, Range <int> tokenRange) : base(file, tokenRange) { type.Parent = this; TypeIdentifier = type; Type = type.ToName(); name.Parent = this; NameIdentifier = name; Name = name.Name; }
public DogeNamedMethodDefinition(DogeIdentifier name, DogeAccessibilityModifier modifier, DogeNamelessMethodDefinition method, DogeFile file, Range <int> tokenRange) : base(file, tokenRange) { name.Parent = this; NameIdentifier = name; Name = name.Name; Modifier = modifier; method.Parent = this; Method = method; }
public DogeIdentifier(string name, DogeFile file, Range <int> tokenRange) : base(file, tokenRange) { Name = name; }
public DogeClassDefinition(DogeAccessibilityModifier modifier, DogeIdentifier name, ICollection <DogeFieldDefinition> fieldDefinitions, ICollection <DogePropertyDefinition> propertyDefinitions, ICollection <DogeNamedMethodDefinition> methodDefinitions, DogeFile file, Range <int> tokenRange) : base(file, tokenRange) { Modifier = modifier; name.Parent = this; NameIdentifier = name; Name = name.Name; fieldDefinitions.ForEach(x => x.Parent = this); FieldDefinitions = fieldDefinitions; propertyDefinitions.ForEach(x => x.Parent = this); PropertyDefinitions = propertyDefinitions; methodDefinitions.ForEach(x => x.Parent = this); MethodDefinitions = methodDefinitions; }
public DogeIdentifier(DogeToken token, DogeFile file) : base(file, new Range <int>(token.Index)) { Debug.Assert(token.DogeTokenType == DogeTokenType.Identifier || token.DogeTokenType == DogeTokenType.Value || token.DogeTokenType == DogeTokenType.Self); Name = token.Text; }