AST API


Defines

#define wi_new   tinyap_wi_new
#define wi_reset   tinyap_wi_reset
#define wi_delete   tinyap_wi_delete
#define wi_node   tinyap_wi_node
#define wi_up   tinyap_wi_up
#define wi_down   tinyap_wi_down
#define wi_next   tinyap_wi_next
#define wi_backup   tinyap_wi_backup
#define wi_restore   tinyap_wi_restore
#define wi_validate   tinyap_wi_validate
#define wi_root   tinyap_wi_root
#define wi_root   tinyap_wi_root
#define wi_dup   tinyap_wi_dup
#define wi_on_root   tinyap_wi_on_root
#define wi_on_leaf   tinyap_wi_on_leaf
#define wi_has_next   tinyap_wi_has_next

Functions

int tinyap_node_is_nil (const ast_node_t)
 predicate "this node is nil"
int tinyap_node_is_list (const ast_node_t)
 predicate "this node is a list"
unsigned int tinyap_list_get_size (const ast_node_t)
 get the length of the list
ast_node_t tinyap_list_get_element (const ast_node_t, int)
 access to the n-th element of this list
int tinyap_node_is_string (const ast_node_t)
 predicate "this node is a string"
const char * tinyap_node_get_string (const ast_node_t)
 access to the string value of this atom
ast_node_t tinyap_node_get_operand (const ast_node_t, int)
 access to the n-th operand of this node ( (n+1)-th element of list)
int tinyap_node_get_operand_count (const ast_node_t)
 get the number of operands in this node (count(list)-1)
const char * tinyap_node_get_operator (const ast_node_t)
 get the operator label of this node
int tinyap_node_get_row (const ast_node_t)
 get the row corresponding to this node in source text
int tinyap_node_get_col (const ast_node_t)
 get the col corresponding to this node in source text
void tinyap_serialize_to_file (const ast_node_t, const char *)
 serialize this node to the named file
const char * tinyap_serialize_to_string (const ast_node_t)
 serialize this node into a new C string (must be freed by the user)
wast_t tinyap_make_wast (const ast_node_t)
 make this AST walkable.
ast_node_t tinyap_make_ast (const wast_t)
 make this walkable AST a serializable AST.
void tinyap_free_wast (const wast_t)
 free this walkable AST.
wast_iterator_t tinyap_wi_new (const wast_t)
 create an iterator on this AST.
wast_iterator_t tinyap_wi_reset (wast_iterator_t)
 reset an iterator to its initial state (on root, backup cleared).
void tinyap_wi_delete (wast_iterator_t)
 destroy an iterator on an AST.
wast_t tinyap_wi_node (wast_iterator_t)
 get node under iterator
wast_iterator_t tinyap_wi_up (wast_iterator_t)
 iterator jumps to parent
wast_iterator_t tinyap_wi_down (wast_iterator_t)
 iterator jumps to first child
wast_iterator_t tinyap_wi_next (wast_iterator_t)
 iterator jumps to next sibling
wast_iterator_t tinyap_wi_backup (wast_iterator_t)
 backup iterator state
wast_iterator_t tinyap_wi_restore (wast_iterator_t)
 restore iterator state
wast_iterator_t tinyap_wi_validate (wast_iterator_t)
 forget previous backup
wast_t tinyap_wi_root (wast_iterator_t)
 get iterator's root.
wast_t tinyap_wi_parent (wast_iterator_t)
 get iterator's current parent.
wast_iterator_t tinyap_wi_dup (const wast_iterator_t)
 predicate "iterator is on root", i.e. "NOT (node has a parent)"
int tinyap_wi_on_root (wast_iterator_t)
 predicate "iterator is on root", i.e. "NOT (node has a parent)"
int tinyap_wi_on_leaf (wast_iterator_t)
 predicate "iterator is on a leaf", i.e. "NOT (node has children)"
int tinyap_wi_has_next (wast_iterator_t)
 predicate "iterator has a next sibling", i.e. "NOT (node is last child)"
const char * tinyap_unparse (wast_t grammar, wast_t ast)
 Render the text buffer that generated the AST ast when parsed using grammar.
void * tinyap_walk_output (const char *pilot_name, void *pilot_init_data)
 walk the current output using this named pilot with this init data.
void * tinyap_walk (const wast_t subtree, const char *pilot_name, void *pilot_init_data)
 walk this subtree using this named pilot with this init data.

Detailed Description


Define Documentation

#define wi_backup   tinyap_wi_backup

Definition at line 250 of file tinyap.h.

#define wi_delete   tinyap_wi_delete

Definition at line 225 of file tinyap.h.

#define wi_down   tinyap_wi_down

Definition at line 240 of file tinyap.h.

#define wi_dup   tinyap_wi_dup

Definition at line 275 of file tinyap.h.

#define wi_has_next   tinyap_wi_has_next

Definition at line 290 of file tinyap.h.

#define wi_new   tinyap_wi_new

Definition at line 215 of file tinyap.h.

#define wi_next   tinyap_wi_next

Definition at line 245 of file tinyap.h.

#define wi_node   tinyap_wi_node

Definition at line 230 of file tinyap.h.

#define wi_on_leaf   tinyap_wi_on_leaf

Definition at line 285 of file tinyap.h.

#define wi_on_root   tinyap_wi_on_root

Definition at line 280 of file tinyap.h.

#define wi_reset   tinyap_wi_reset

Definition at line 220 of file tinyap.h.

#define wi_restore   tinyap_wi_restore

Definition at line 255 of file tinyap.h.

#define wi_root   tinyap_wi_root

Definition at line 270 of file tinyap.h.

#define wi_root   tinyap_wi_root

Definition at line 270 of file tinyap.h.

#define wi_up   tinyap_wi_up

Definition at line 235 of file tinyap.h.

#define wi_validate   tinyap_wi_validate

Definition at line 260 of file tinyap.h.


Function Documentation

void tinyap_free_wast ( const   wast_t  ) 

free this walkable AST.

ast_node_t tinyap_list_get_element ( const   ast_node_t,
int   
)

access to the n-th element of this list

Referenced by TinyaP::AstNode::getOperator(), and TinyaP::AstNode::isOp().

Here is the caller graph for this function:

unsigned int tinyap_list_get_size ( const   ast_node_t  ) 

get the length of the list

ast_node_t tinyap_make_ast ( const   wast_t  ) 

make this walkable AST a serializable AST.

Returns:
a serializable copy of the given tree.

wast_t tinyap_make_wast ( const   ast_node_t  ) 

make this AST walkable.

Returns:
a walkable copy of the given tree.

int tinyap_node_get_col ( const   ast_node_t  ) 

get the col corresponding to this node in source text

Referenced by TinyaP::AstNode::getCol().

Here is the caller graph for this function:

ast_node_t tinyap_node_get_operand ( const   ast_node_t,
int   
)

access to the n-th operand of this node ( (n+1)-th element of list)

int tinyap_node_get_operand_count ( const   ast_node_t  ) 

get the number of operands in this node (count(list)-1)

const char* tinyap_node_get_operator ( const   ast_node_t  ) 

get the operator label of this node

int tinyap_node_get_row ( const   ast_node_t  ) 

get the row corresponding to this node in source text

Referenced by TinyaP::AstNode::getRow().

Here is the caller graph for this function:

const char* tinyap_node_get_string ( const   ast_node_t  ) 

access to the string value of this atom

Referenced by TinyaP::AstNode::getOperator(), and TinyaP::AstNode::getString().

Here is the caller graph for this function:

int tinyap_node_is_list ( const   ast_node_t  ) 

predicate "this node is a list"

Returns:
1 if node is a pair, 0 otherwise

Referenced by TinyaP::AstNode::isList(), and TinyaP::AstNode::isOp().

Here is the caller graph for this function:

int tinyap_node_is_nil ( const   ast_node_t  ) 

predicate "this node is nil"

Returns:
1 if node pointer is NULL, 0 otherwise

Referenced by TinyaP::AstNode::isNil().

Here is the caller graph for this function:

int tinyap_node_is_string ( const   ast_node_t  ) 

predicate "this node is a string"

Returns:
1 if node is an atom, 0 otherwise

Referenced by TinyaP::AstNode::isOp(), and TinyaP::AstNode::isString().

Here is the caller graph for this function:

void tinyap_serialize_to_file ( const   ast_node_t,
const char *   
)

serialize this node to the named file

Referenced by TinyaP::AstNode::toFile().

Here is the caller graph for this function:

const char* tinyap_serialize_to_string ( const   ast_node_t  ) 

serialize this node into a new C string (must be freed by the user)

Referenced by TinyaP::AstNode::toString().

Here is the caller graph for this function:

const char* tinyap_unparse ( wast_t  grammar,
wast_t  ast 
)

Render the text buffer that generated the AST ast when parsed using grammar.

void* tinyap_walk ( const wast_t  subtree,
const char *  pilot_name,
void *  pilot_init_data 
)

walk this subtree using this named pilot with this init data.

Returns:
whatever the pilot evaluated to

void* tinyap_walk_output ( const char *  pilot_name,
void *  pilot_init_data 
)

walk the current output using this named pilot with this init data.

Returns:
whatever the pilot evaluated to

wast_iterator_t tinyap_wi_backup ( wast_iterator_t   ) 

backup iterator state

void tinyap_wi_delete ( wast_iterator_t   ) 

destroy an iterator on an AST.

wast_iterator_t tinyap_wi_down ( wast_iterator_t   ) 

iterator jumps to first child

wast_iterator_t tinyap_wi_dup ( const   wast_iterator_t  ) 

predicate "iterator is on root", i.e. "NOT (node has a parent)"

int tinyap_wi_has_next ( wast_iterator_t   ) 

predicate "iterator has a next sibling", i.e. "NOT (node is last child)"

wast_iterator_t tinyap_wi_new ( const   wast_t  ) 

create an iterator on this AST.

wast_iterator_t tinyap_wi_next ( wast_iterator_t   ) 

iterator jumps to next sibling

wast_t tinyap_wi_node ( wast_iterator_t   ) 

get node under iterator

int tinyap_wi_on_leaf ( wast_iterator_t   ) 

predicate "iterator is on a leaf", i.e. "NOT (node has children)"

int tinyap_wi_on_root ( wast_iterator_t   ) 

predicate "iterator is on root", i.e. "NOT (node has a parent)"

wast_t tinyap_wi_parent ( wast_iterator_t   ) 

get iterator's current parent.

wast_iterator_t tinyap_wi_reset ( wast_iterator_t   ) 

reset an iterator to its initial state (on root, backup cleared).

wast_iterator_t tinyap_wi_restore ( wast_iterator_t   ) 

restore iterator state

wast_t tinyap_wi_root ( wast_iterator_t   ) 

get iterator's root.

wast_iterator_t tinyap_wi_up ( wast_iterator_t   ) 

iterator jumps to parent

wast_iterator_t tinyap_wi_validate ( wast_iterator_t   ) 

forget previous backup


Generated on Sun May 11 14:32:44 2008 for TINYAP by  doxygen 1.5.3