Пример #1
0
        public Runtime(IOperatorShufflerFactory shuffler, TextWriter Out, TextReader In, TextWriter Error)
        {
            this.operatorShufflerFactory = shuffler;
            this.Out = Out;
            this.In = In;
            this.Error = Error;

            Base = new IokeObject(this, "Base is the top of the inheritance structure. Most of the objects in the system are derived from this instance. Base should keep its cells to the bare minimum needed for the system.");
            IokeGround = new IokeObject(this, "IokeGround is the place that mimics default behavior, and where most global objects are defined.");
            Ground = new IokeObject(this, "Ground is the default place code is evaluated in.");
            System = new IokeObject(this, "System defines things that represents the currently running system, such as the load path.", new IokeSystem());
            DefaultBehavior = new IokeObject(this, "DefaultBehavior is a mixin that provides most of the methods shared by most instances in the system.");
            Origin = new IokeObject(this, "Any object created from scratch should usually be derived from Origin.");
            Message = new IokeObject(this, "A Message is the basic code unit in Ioke.", new Message(this, ""));
            Text = new IokeObject(this, "Contains an immutable piece of text.", new Text(""));
            Symbol = new IokeObject(this, "Represents a symbol - an object that always represents itself.", new Symbol(""));
            nil = new IokeObject(this, "nil is an oddball object that always represents itself. It can not be mimicked and (alongside false) is one of the two false values.", IokeData.Nil);
            True = new IokeObject(this, "true is an oddball object that always represents itself. It can not be mimicked and represents the a true value.", IokeData.True);
            False = new IokeObject(this, "false is an oddball object that always represents itself. It can not be mimicked and (alongside nil) is one of the two false values.", IokeData.False);
            List = new IokeObject(this, "A list is a collection of objects that can change size", new IokeList());
            Method = new IokeObject(this, "Method is the origin of all methods in the system, both default and Java..", new Method((string)null));
            NativeMethod = new IokeObject(this, "NativeMethod is a derivation of Method that represents a primitive implemented in Java.", new NativeMethod.WithNoArguments((string)null, null));
            Io = new IokeObject(this, "IO is the base for all input/output in Ioke.", new IokeIO());
            Condition = new IokeObject(this, "The root mimic of all the conditions in the system.");
            Number = new IokeObject(this, "Represents an exact number", new Number(Ioke.Lang.Number.GetFrom("0")));
            Dict = new IokeObject(this, "A dictionary is a collection of mappings from one object to another object. The default Dict implementation will use hashing for this.", new Dict());
            DefaultMethod = new IokeObject(this, "DefaultMethod is the instance all methods in the system are derived from.", new DefaultMethod((string)null));
            DefaultMacro = new IokeObject(this, "DefaultMacro is the instance all non-lexical macros in the system are derived from.", new DefaultMacro((string)null));
            Call = new IokeObject(this, "A call is the runtime structure that includes the specific information for a call, that is available inside a DefaultMacro.", new Call());
            Locals = new IokeObject(this, "Contains all the locals for a specific invocation.");
            LexicalBlock = new IokeObject(this, "A lexical block allows you to delay a computation in a specific lexical context. See DefaultMethod#fn for detailed documentation.", new LexicalBlock(this.Ground));
            LexicalContext = new LexicalContext(this, this.Ground, "A lexical activation context.", null, this.Ground);
            DefaultSyntax = new IokeObject(this, "DefaultSyntax is the instance all syntactical macros in the system are derived from.", new DefaultSyntax((string)null));
            Range = new IokeObject(this, "A range is a collection of two objects of the same kind. This Range can be either inclusive or exclusive.", new Range(nil, nil, false, false));
            Restart = new IokeObject(this, "A Restart is the actual object that contains restart information.");
            Rescue = new IokeObject(this, "A Rescue contains handling information from rescuing a Condition.");
            Handler = new IokeObject(this, "A Handler contains handling information for handling a condition without unwinding the stack.");
            Mixins = new IokeObject(this, "Mixins is the name space for most mixins in the system. DefaultBehavior is the notable exception.");
            _Runtime = new IokeObject(this, "Runtime gives meta-circular access to the currently executing Ioke runtime.");
            Pair = new IokeObject(this, "A pair is a collection of two objects of any kind. They are used among other things to represent Dict entries.", new Pair(nil, nil));
            Regexp = new IokeObject(this, "A regular expression allows you to matching text against a pattern.", Ioke.Lang.Regexp.Create("", ""));
            FileSystem = new IokeObject(this, "Gives access to things related to the file system.");
            Set = new IokeObject(this, "A set is an unordered collection of objects that contains no duplicates.", new IokeSet());
            Arity = new IokeObject(this, "Arity provides information about the arguments needed to activate a value.", new Arity((DefaultArgumentsDefinition) null));
            LexicalMacro = new IokeObject(this, "LexicalMacro is the instance all lexical macros in the system are derived from.", new LexicalMacro((string)null));
            DateTime = new IokeObject(this, "A DateTime represents the current date and time in a particular time zone.", new DateTime(0));

            asText = NewMessage("asText");
            opShuffle = NewMessage("shuffleOperators");
            printlnMessage = NewMessage("println");
            outMessage = NewMessage("out");
            nilMessage = NewMessage("nil");
            isApplicableMessage = NewMessage("applicable?");
            errorMessage = NewMessage("error!");
            mimicMessage = NewMessage("mimic");
            callMessage = NewMessage("call");
            handlerMessage = NewMessage("handler");
            nameMessage = NewMessage("name");
            conditionsMessage = NewMessage("conditions");
            codeMessage = NewMessage("code");
            testMessage = NewMessage("test");
            printMessage = NewMessage("print");
            reportMessage = NewMessage("report");
            currentDebuggerMessage = NewMessage("currentDebugger");
            invokeMessage = NewMessage("invoke");
            minusMessage = NewMessage("-");
            asRationalMessage = NewMessage("asRational");
            spaceShipMessage = NewMessage("<=>");
            succMessage = NewMessage("succ");
            predMessage = NewMessage("pred");
            setValueMessage = NewMessage("=");
            inspectMessage = NewMessage("inspect");
            noticeMessage = NewMessage("notice");
            removeCellMessage = NewMessage("removeCell!");
            eachMessage = NewMessage("each");
            plusMessage = NewMessage("+");
            multMessage = NewMessage("*");
            divMessage = NewMessage("/");
            modMessage = NewMessage("%");
            expMessage = NewMessage("**");
            binAndMessage = NewMessage("&");
            binOrMessage = NewMessage("|");
            binXorMessage = NewMessage("^");
            lshMessage = NewMessage("<<");
            rshMessage = NewMessage(">>");
            eqqMessage = NewMessage("===");
            asDecimalMessage = NewMessage("asDecimal");
            ltMessage = NewMessage("<");
            lteMessage = NewMessage("<=");
            gtMessage = NewMessage(">");
            gteMessage = NewMessage(">=");
            eqMessage = NewMessage("==");
            asSymbolMessage = NewMessage("asSymbol");
            FileMessage = NewMessage("File");
            closeMessage = NewMessage("close");

            nul = new NullObject(this);

            symbolTable = new SaneDictionary<string, IokeObject>();
        }
Пример #2
0
 public Runtime(IOperatorShufflerFactory shuffler)
     : this(shuffler, Console.Out, Console.In, Console.Error)
 {
 }