KumiScript/interpreter/expression/Expression.cs

70 lines
1.7 KiB
C#
Raw Normal View History

2024-01-26 05:37:51 +00:00
namespace KumiScript.Interpreter
{
public class Expression
2024-01-26 05:37:51 +00:00
{
public virtual Expression Eval(Environment env)
2024-01-26 05:37:51 +00:00
{
return this;
2024-01-26 05:37:51 +00:00
}
public virtual decimal GetValueAsFloat()
{
throw new InterpreterTypingException();
}
public virtual Expression Car()
{
throw new InterpreterTypingException();
}
public virtual Expression Cdr()
{
throw new InterpreterTypingException();
}
public virtual ProperListExpression Cons(Expression expr)
{
throw new InterpreterTypingException();
}
public virtual ProperListExpression AppendToList(Expression expr)
{
List<Expression> el = new List<Expression>(2)
{
this,
expr
};
return new ProperListExpression(el);
}
public virtual List<Expression> EvalMembers(Environment env)
{
throw new InterpreterTypingException();
}
public virtual List<Expression> GetMembers()
{
throw new InterpreterTypingException();
}
public virtual Symbol GetSymbol()
{
throw new InterpreterTypingException();
}
public virtual Expression Apply(Expression operand, Environment env)
{
throw new InterpreterTypingException();
}
public virtual bool IsPrimitive()
{
throw new InterpreterTypingException();
}
public virtual bool Equals (Expression expr)
{
return ReferenceEquals(this, expr);
}
2024-01-26 05:37:51 +00:00
}
}