2017-09-29

(sph lang itml eval)

evaluate itml inline code expressions and possibly translate to a new format.

library description

itml inline code expressions can evaluate to non-itml syntax for the target language.

# data structures

itml-state: ((any:source-id ...) integer:depth hashtable:data)

import name

(sph lang itml eval)

exports

itml-eval

procedure

signature

a itml-state descend ascend terminal ->

list:parsed-itml list procedure procedure procedure -> any

itml-eval*

procedure

signature

descend-prefix-ht ascend-prefix-ht [terminal descend-alt ascend-alt] ->

description

hashtable hashtable [procedure procedure procedure] -> procedure

returns a procedure similar to itml-eval that uses expression handler procedures from hashtables.

the -prefix-ht hashtables map list prefixes to tail handlers that map a expression to a result.

if the prefix is not found in one of the hashtables then the corresponding -alt procedure is called

itml-eval-asc-indent-expr

procedure

signature

a b ... ->

itml-eval-asc-inline-expr

procedure

signature

a b ... ->

itml-eval-asc-line-expr

procedure

signature

a b ... ->

itml-eval-call

procedure

signature

input itml-state proc ->

description

any procedure:{any:input list:itml-state} -> any

protects against circular inclusion by checking and updating itml-state

itml-eval-call-proc

procedure

signature

itml-eval-any itml-eval ->

symbol procedure -> procedure

description

extend an itml-eval-* procedure to be passed directly to itml-call-for-*

itml-eval-desc-indent-expr

procedure

signature

a b ... ->

list procedure integer list environment -> any

description

evaluate an inline code expression when all elements are strings or string lists.

converts the prefix to a symbol and prepares lists to evaluate to lists

itml-eval-desc-indent-scm-expr

procedure

signature

a re-descend sources depth data ->

description

evaluate an inline code expression

itml-eval-desc-inline-scm-expr

procedure

signature

a re-descend sources depth data ->

description

evaluate an inline code expression

itml-eval-desc-line-expr

procedure

signature

a b ... ->

list procedure integer list environment -> any

description

evaluate an inline code expression when all elements are strings or string lists.

converts the prefix to a symbol and prepares lists to evaluate to lists

itml-eval-desc-line-scm-expr

procedure

signature

a re-descend sources depth data ->

description

evaluate an inline code expression

itml-eval-descend

procedure

signature

a re-descend sources depth data ->

description

evaluate an inline code expression

itml-eval-descend-string

procedure

signature

a b ... ->

list procedure integer list environment -> any

description

evaluate an inline code expression when all elements are strings or string lists.

converts the prefix to a symbol and prepares lists to evaluate to lists

itml-eval-file

procedure

signature

itml-eval a b ... ->

itml-eval-list

procedure

signature

a env exceptions state ->

(symbol any ...) environment list -> any

description

creates the syntax for a lambda that contains the code from the itml expression,

and uses eval to create a procedure from it.

the procedure is called with the itml state object from the call to evaluate the itml.

this supports the use of syntax in itml expressions

itml-eval-port

procedure

signature

itml-eval a b ... ->

itml-eval-string

procedure

signature

itml-eval a b ... ->

itml-state-copy

procedure

signature

a ->

itml-state-create

procedure

signature

[depth env exceptions data] ->

integer environment hashtable ... -> list

description

data, if passed, will be modified

itml-state-data

procedure

signature

a ->

itml-state-depth

procedure

signature

a ->

sph-lang-itml-eval-description

variable

tags: guile documentation library scheme sph-lib computer sph-lang-itml-eval