Parser routines


Functions

sexp_errcode_t set_parser_buffer_params (size_t ss, size_t gs)
sexp_tparse_sexp (char *s, size_t len)
sexp_tiparse_sexp (char *s, size_t len, pcont_t *cc)
pcont_tcparse_sexp (char *s, size_t len, pcont_t *pc)

Function Documentation

pcont_t* cparse_sexp char *  s,
size_t  len,
pcont_t pc
 

given a LISP style s-expression string, parse it into a set of connected sexp_t structures.

sexp_t* iparse_sexp char *  s,
size_t  len,
pcont_t cc
 

wrapper around parser for friendlier continuation use pre-condition : continuation (cc) is NON-NULL!

sexp_t* parse_sexp char *  s,
size_t  len
 

wrapper around parser for compatibility.

sexp_errcode_t set_parser_buffer_params size_t  ss,
size_t  gs
 

Set the parameters on atom value buffer allocation and growth sizes. This is an important point for performance tuning, as many factors in the expected expression structure must be taken into account such as:

  • Average size of atom values
  • Variance in sizes of atom values
  • Amount of memory that is tolerably ''wasted'' (allocated but not used)

The ss parameter specifies the initial size of all atom buffers. Ideally, this should be sufficiently large to capture MOST atom values, or at least close enough such that one growth is required. The gs parameter specifies the number of bytes to increase the buffer size by when space is exhausted. A safe choice for parameter sizes would be on the order of the average size for ss, and one standard deviation for gs. This ensures that 50% of all expressions are guaranteed to fit in the initial buffer, and rougly 80-90% will fit in one growth. If memory is not an issue, choosing ss to be the mean plus one standard deviation will capture 80-90% of expressions in the initial buffer, and a gs of one standard deviation will capture nearly all expressions.

Note: These parameters can be tuned at runtime as needs change, and they will be applied to all expressions and expression elements parsed after they are modified. They will not be applied retroactively to expressions that have already been parsed.


Generated on Thu Oct 25 01:19:37 2007 for Small, Fast S-Expression Library by  doxygen 1.4.6