public override void print(Node t, int n, bool p) { // print leading spaces and ' if (n < 0) { n = -(n + 1); } Console.Write(new string(' ', n) + "'"); // if quote a list if (t.getCdr().getCar().isPair()) { // this while is to print following quote as ' to get the sample output while (t.getCdr().getCar().getCar().isSymbol() && ((Ident) t.getCdr().getCar().getCar()).getName().Equals("quote")) { Console.Write("'"); t = t.getCdr().getCar(); } // using the Regular form to print quoted list Special v = new Regular(); v.print(t.getCdr().getCar(), 0, false); // if the caller asks for change line if (n > 0) { Console.WriteLine(); } } // if quote a single element else { t.getCdr().getCar().print(0); } }
public override void print(Node t, int n, bool p) { // if the element following define is not a cons, than this is the variable definition syntax of define // this syntax is virtually same as Regular if (!t.getCdr().getCar().isPair()) { Special v = new Regular(); v.print(t, n, p); } // function definition syntax of define // this syntax is virtually same as If else { Special v = new If(); v.print(t, n, p); } }
public override void print(Node t, int n, bool p) { // Set is virtually same as Regular Special v = new Regular(); v.print(t, n, p); }