Beispiel #1
0
 public Term(Sexp s)
 {
     if (s.Type == Sexp.SexpType.SYMBOL)
     {
         this.Text = s.Text;
         if (this.IsVariable(s.Text))
         {
             this.Type = TermType.VARIABLE;
         }
         else
         {
             this.Type = TermType.CONSTANT;
         }
     }
     else if (s.Type == Sexp.SexpType.STRING)
     {
         this.Text = s.Text;
         this.Type = TermType.CONSTANT;
     }
     else if (s.Type == Sexp.SexpType.NUMBER)
     {
         this.Text = s.Number.ToString();
         this.Type = TermType.CONSTANT;
     }
     else
     {
         throw new Exception($"Unrecognizable term type: {s.Repr()}");
     }
 }