예제 #1
0
파일: Interpreter.cs 프로젝트: basp/xil
        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));
        }