#include <iostream>
#include "Cell.hpp"
Go to the source code of this file.
Functions | |
Cell * | make_int (const int i) |
Make an int cell. | |
Cell * | make_double (const double d) |
Make a double cell. | |
Cell * | make_symbol (const char *const s) |
Make a symbol cell. | |
Cell * | cons (Cell *const my_car, Cell *const my_cdr) |
Make a conspair cell. | |
Cell * | lambda (Cell *const my_formals, Cell *const my_body) |
Make a procedure cell. | |
bool | nullp (Cell *const c) |
Check if c points to an empty list, i.e., is a null pointer. | |
bool | listp (Cell *const c) |
Check if c points to a list (i.e., nil or a cons cell). | |
bool | procedurep (Cell *const c) |
Check if c is a procedure cell. | |
bool | intp (Cell *const c) |
Check if c points to an int cell. | |
bool | doublep (Cell *const c) |
Check if c points to a double cell. | |
bool | symbolp (Cell *const c) |
Check if c points to a symbol cell. | |
int | get_int (Cell *const c) |
Accessor (error if c is not an int cell). | |
double | get_double (Cell *const c) |
Accessor (error if c is not a double cell). | |
string | get_symbol (Cell *const c) |
Retrieve the symbol name as a string (error if c is not a symbol cell). | |
Cell * | car (Cell *const c) |
Accessor (error if c is not a cons cell). | |
Cell * | cdr (Cell *const c) |
Accessor (error if c is not a string cell). | |
Cell * | get_formals (Cell *const c) |
Accessor (error if c is not a procedure cell). | |
Cell * | get_body (Cell *const c) |
Accessor (error if c is not a procedure cell). | |
ostream & | operator<< (ostream &os, const Cell &c) |
Print the subtree rooted at c, in s-expression notation. | |
Variables | |
Cell *const | nil |
The null pointer value. |
Cell* car | ( | Cell *const | c | ) | [inline] |
Accessor (error if c is not a cons cell).
Cell* cdr | ( | Cell *const | c | ) | [inline] |
Accessor (error if c is not a string cell).
Cell* cons | ( | Cell *const | my_car, | |
Cell *const | my_cdr | |||
) | [inline] |
Make a conspair cell.
my_car | The initial car pointer to be stored in the new cell. | |
my_cdr | The initial cdr pointer to be stored in the new cell. |
Referenced by c_cons().
bool doublep | ( | Cell *const | c | ) | [inline] |
Cell* get_body | ( | Cell *const | c | ) | [inline] |
Accessor (error if c is not a procedure cell).
double get_double | ( | Cell *const | c | ) | [inline] |
Accessor (error if c is not a double cell).
Cell* get_formals | ( | Cell *const | c | ) | [inline] |
Accessor (error if c is not a procedure cell).
int get_int | ( | Cell *const | c | ) | [inline] |
Accessor (error if c is not an int cell).
string get_symbol | ( | Cell *const | c | ) | [inline] |
Retrieve the symbol name as a string (error if c is not a symbol cell).
bool intp | ( | Cell *const | c | ) | [inline] |
Cell* lambda | ( | Cell *const | my_formals, | |
Cell *const | my_body | |||
) | [inline] |
Make a procedure cell.
my_formals | A list of the procedure's formal parameter names. | |
my_body | The body (an expression) of the procedure. |
bool listp | ( | Cell *const | c | ) | [inline] |
Check if c points to a list (i.e., nil or a cons cell).
References nullp().
Cell* make_double | ( | const double | d | ) | [inline] |
Make a double cell.
d | The initial double value to be stored in the new cell. |
Referenced by c_make_double().
Cell* make_int | ( | const int | i | ) | [inline] |
Make an int cell.
i | The initial int value to be stored in the new cell. |
Referenced by c_make_int().
Cell* make_symbol | ( | const char *const | s | ) | [inline] |
Make a symbol cell.
s | The initial symbol name to be stored in the new cell. |
Referenced by c_make_symbol().
bool nullp | ( | Cell *const | c | ) | [inline] |
ostream& operator<< | ( | ostream & | os, | |
const Cell & | c | |||
) | [inline] |
Print the subtree rooted at c, in s-expression notation.
os | The output stream to print to. | |
c | The root cell of the subtree to be printed. |
bool procedurep | ( | Cell *const | c | ) | [inline] |
bool symbolp | ( | Cell *const | c | ) | [inline] |
Cell* const nil |