Ejemplo n.º 1
0
 private void Execterm(Value.List p)
 {
     foreach (var fac in p.Elements)
     {
         this.Exec(fac);
     }
 }
Ejemplo n.º 2
0
        private void Infra_()
        {
            new Validator("infra")
            .TwoParameters()
            .OneQuote()
            .ListAsSecond()
            .Validate(this.stack);

            var p     = this.Pop <Value.List>();
            var l1    = this.Pop <Value.List>();
            var saved = this.stack.Clone();

            this.stack = new Stack <IValue>(l1.Elements.Reverse().ToArray());
            this.Execterm(p);
            var l2 = new Value.List(this.stack.ToArray());

            this.stack = saved;
            this.Push(l2);
        }
Ejemplo n.º 3
0
        private void Name_()
        {
            new Validator("name")
            .OneParameter()
            .Validate(this.stack);

            var sym  = this.Pop();
            var name = sym switch
            {
                Value.Int x => "int",
                Value.Float x => "float",
                Value.Bool x => "bool",
                Value.Char x => "char",
                Value.String x => "string",
                Value.List x => "list",
                Value.Set x => "set",
                Value.Stream x => "stream",
                Value.Symbol x => x.Value,
                _ => throw new NotSupportedException(),
            };

            this.Push(new Value.String(name));
        }
Ejemplo n.º 4
0
 public void AddUsrdef(string name, Value.List body)
 {
     this.usrdefs[name] = body;
 }