Example #1
0
        // POSTPONE word-name
        // ( -- )
        private int PostponeAction()
        {
            if (_interpreter.IsCompiling == false)
            {
                throw new Exception("POSTPONE outside a new word definition.");
            }

            _interpreter.WordBeingDefined.AddWord(_interpreter.GetWord(_interpreter.ParseWord()));

            return(1);
        }
Example #2
0
        // (n -- ) or (F: f -- )
        private int ToAction()
        {
            _interpreter.StackExpect(1);

            var valueWord = _interpreter.GetWord(_interpreter.ParseWord());

            if (valueWord is SingleCellValueWord)
            {
                ((SingleCellValueWord)valueWord).Value = _interpreter.Pop();

                return(1);
            }
            else if (valueWord is FloatingPointValueWord)
            {
                ((FloatingPointValueWord)valueWord).Value = _interpreter.FPop();

                return(1);
            }

            throw new Exception("A VALUE or FVALUE created word expected.");
        }