eval.hh File Reference

Interface of the block diagram evaluator. More...

#include "boxes.hh"
#include "sourcereader.hh"
#include "environment.hh"
Include dependency graph for eval.hh:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

Tree evalprocess (Tree eqlist)
 Eval the definition of 'process'.
Tree evaldocexpr (Tree docexpr, Tree eqlist)
bool searchIdDef (Tree id, Tree &def, Tree lenv)
 Search the environment for the definition of a symbol ID and return it.
Tree pushValueDef (Tree id, Tree def, Tree lenv)
 Push a new layer and add a single definition.
Tree simplifyPattern (Tree pattern)
 Simplify a block-diagram pattern by computing its numerical sub-expressions.

Detailed Description

Interface of the block diagram evaluator.

A strict lambda-calculus evaluator for block diagram expressions.

Definition in file eval.hh.


Function Documentation

Tree evaldocexpr ( Tree  docexpr,
Tree  eqlist 
)

Definition at line 110 of file eval.cpp.

References a2sb(), eval(), nil, and pushMultiClosureDefs().

Referenced by mapEvalDocEqn(), and printDocDgm().

00111 {
00112     return a2sb(eval(docexpr, nil, pushMultiClosureDefs(eqlist, nil, nil)));
00113 }

Here is the call graph for this function:

Here is the caller graph for this function:

Tree evalprocess ( Tree  eqlist  ) 

Eval the definition of 'process'.

Eval the definition of 'process' in the environment passed as argument

Parameters:
eqlist the global environment (a list of definitions)
Returns:
the 'process' block diagram in normal form that is

Eval the definition of 'process'.

Strict evaluation of a block diagram expression by applying beta reduction.

Parameters:
eqlist a list of faust defintions forming the the global environment
Returns:
the process block diagram in normal form

Definition at line 102 of file eval.cpp.

References a2sb(), boxIdent(), eval(), nil, and pushMultiClosureDefs().

Referenced by main().

00103 {
00104     return a2sb(eval(boxIdent("process"), nil, pushMultiClosureDefs(eqlist, nil, nil)));
00105 }

Here is the call graph for this function:

Here is the caller graph for this function:

Tree pushValueDef ( Tree  id,
Tree  def,
Tree  lenv 
)

Push a new layer and add a single definition.

Parameters:
id the symbol id to be defined
def the definition to be binded to the symbol id
lenv the environment where to push the layer and add the definition
Returns:
the new environment

Definition at line 64 of file environment.cpp.

00065 {
00066     Tree lenv2 = pushNewLayer(lenv);
00067     addLayerDef(id, def, lenv2);
00068     return lenv2;
00069 }

bool searchIdDef ( Tree  id,
Tree def,
Tree  lenv 
)

Search the environment for the definition of a symbol ID and return it.

Parameters:
id the symbol ID to search
def where to store the definition if any
lenv the environment
Returns:
true if a definition was found

Definition at line 104 of file environment.cpp.

00105 {
00106     // search the environment until a definition is found
00107     // or nil (the empty environment) is reached
00108     while (!isNil(lenv) && !getProperty(lenv, id, def)) {
00109         lenv = lenv->branch(0);
00110     }
00111     return !isNil(lenv);
00112 }

Tree simplifyPattern ( Tree  value  ) 

Simplify a block-diagram pattern by computing its numerical sub-expressions.

Parameters:
pattern an evaluated block-diagram
Returns:
a simplified pattern

Definition at line 623 of file eval.cpp.

00624 {
00625     Tree num;
00626     if (!getNumericProperty(value,num)) {
00627         if (!isBoxNumeric(value,num)) {
00628             num = value;
00629         }
00630         setNumericProperty(value,num);
00631     }
00632     return num;
00633 }

Generated on Thu Jul 15 16:15:40 2010 for FAUST compiler by  doxygen 1.6.3