1 /++ Programming concepts that capture semantic that is common among different 2 programming language, both imperative, functional and declarative. 3 4 The class hierarchy together class fields, member functions and UDAs encode 5 the semantics of the above mentioned concepts. +/ 6 module nxt.agnostics; 7 8 @safe pure nothrow: 9 10 class Point {} 11 class Node {} 12 class Token : Node { 13 @safe pure nothrow /+@nogc+/: 14 @property Point start() const { return new typeof(return)(); } 15 @property Point end() const { return new typeof(return)(); } 16 } 17 class Comment : Token {} 18 class EndOfLineComment : Token {} 19 class MultiLineComment : Token {} 20 class Literal : Token {} 21 class StringLiteral : Literal {} 22 class CharacterLiteral : Literal {} 23 class NumericLiteral : Literal {} 24 class IntegerLiteral : Literal {} 25 class FloatingPointLiteral : Literal {} 26 class Symbol : Token {} 27 class SymbolReference : Token {} 28 class Tree : Node {} 29 class Declaration : Tree { 30 @safe pure nothrow @nogc: 31 Node[] ctParams; ///< Compile-time parameters. 32 @property bool isTemplate() const => ctParams.length != 0; 33 } 34 class Type : Declaration {} 35 class ScalarType : Type {} 36 class ArithmeticType : ScalarType {} 37 class CharacterType : ScalarType {} 38 class StringType : Type {} 39 class AggregateType : Type {} 40 class ValueAggregateType : AggregateType {} 41 class StructType : ValueAggregateType {} 42 class AnonymousStructType : AggregateType {} 43 alias TupleType = AnonymousStructType; 44 class UnionType : AggregateType {} 45 class ClassType : AggregateType {} 46 class EnumerationType : Type {} 47 class ArrayType : Type {} 48 class MachineWordType : Type {} 49 class AddressType : MachineWordType {} 50 class SizeType : MachineWordType {} 51 class PointerType : AddressType {} // pointer 52 class ReferenceType : AddressType {} // D class 53 class FunctionType : Type {} 54 class Definition : Node {} 55 class LabelDefinition : Definition {} 56 class FunctionDefinition : Definition {} 57 class ClassDefinition : Definition {} 58 class InterfaceDefinition : Definition {} 59 class EnumDefinition : Definition {} 60 class UnionDefinition : Definition {} 61 class StructDefinition : Definition {} 62 class Instance : Node {} 63 class VariableInstance : Instance {} 64 class FunctionInstance : Instance {} 65 class ClassInstance : Instance {} 66 class InterfaceInstance : Instance {} 67 class EnumInstance : Instance {} 68 class UnionInstance : Instance {} 69 class StructInstance : Instance {} 70 class Statement {} 71 class FunctionCallStatement : Statement {} 72 class ControlFlowStatement : Statement {} 73 class IfStatement : ControlFlowStatement {} 74 class SwitchStatement : ControlFlowStatement {} 75 class ForStatement : ControlFlowStatement {} 76 class WhileStatement : ControlFlowStatement {} 77 class DoWhileStatement : ControlFlowStatement {} 78 class BreakStatement : ControlFlowStatement {} 79 class ContinueStatement : ControlFlowStatement {} 80 class ReturnStatement : ControlFlowStatement {} 81 class GotoStatement : ControlFlowStatement {} 82 class ExceptionHandling : Node {} 83 class TryBlock : ExceptionHandling {} 84 class CatchBlock : ExceptionHandling {} 85 class FinallyBlock : ExceptionHandling {} 86 class ThrowStatement : ExceptionHandling {} 87 class Module : Node {} 88 class Package : Node {} 89 class ImportStatement : Node {} 90 class SymboImportStatement : Node {} 91 class AccessModifiers {} 92 class PublicModifier : AccessModifiers {} 93 class PrivateModifier : AccessModifiers {} 94 class ProtectedModifier : AccessModifiers {} 95 class InternalModifier : AccessModifiers {} 96 class Annotation : Node {} 97 class Decorator : Node {} 98 class Concurrency {} 99 class Thread : Concurrency {} 100 class AsyncAwait : Concurrency {} 101 class Lock : Concurrency {} 102 103 @safe pure nothrow unittest { 104 auto d = new Declaration(); 105 assert(!d.isTemplate); 106 }