Exemple #1
0
        // : word-name body ;
        private int SemicolonAction()
        {
            // Each user defined word exits with the EXIT word.
            _interpreter.WordBeingDefined.AddWord(new ExitControlWord(_interpreter, _interpreter.WordBeingDefined));

            _interpreter.EndNewWordCompilation();

            return(1);
        }
Exemple #2
0
        // FCONSTANT word-name
        // (F: f -- )
        private int FConstantAction()
        {
            _interpreter.FStackExpect(1);

            _interpreter.BeginNewWordCompilation();
            _interpreter.AddWord(new FloatingPointConstantWord(_interpreter, _interpreter.ParseWord(), _interpreter.FPop()));
            _interpreter.EndNewWordCompilation();

            return(1);
        }
Exemple #3
0
        // 2CONSTANT word-name
        // (n1 n2 -- )
        private int TwoConstantAction()
        {
            _interpreter.StackExpect(2);

            _interpreter.BeginNewWordCompilation();
            var n2 = _interpreter.Pop();

            _interpreter.AddWord(new DoubleCellConstantWord(_interpreter, _interpreter.ParseWord(), _interpreter.Pop(), n2));
            _interpreter.EndNewWordCompilation();

            return(1);
        }
Exemple #4
0
        // OVARIABLE word-name
        // ( -- )
        private int VariableCompilationAction()
        {
            _interpreter.BeginNewWordCompilation();
            _interpreter.AddWord(new ConstantWord(_interpreter, _interpreter.ParseWord(), _interpreter.State.ObjectHeap.Alloc(1)));
            _interpreter.EndNewWordCompilation();

            return(1);
        }
Exemple #5
0
        // : word-name body ;
        // :NONAME body ;
        private int SemicolonAction()
        {
            // Each user defined word exits with the EXIT word.
            _interpreter.WordBeingDefined.AddWord(new ExitControlWord(_interpreter, _interpreter.WordBeingDefined));

            _interpreter.EndNewWordCompilation();

            // Compilation of NONAME words leaves their execution token on the stack.
            if (_interpreter.WordBeingDefined is NonameWord)
            {
                _interpreter.StackFree(1);

                _interpreter.Push(_interpreter.WordBeingDefined.ExecutionToken);
            }

            return(1);
        }