eval.hh File Reference

Interface of the block diagram evaluator. More...

#include "boxes.hh"
#include "sourcereader.hh"

Go to the source code of this file.

Functions

Tree evalprocess (Tree eqlist)
 Eval the definition of 'process'.
bool getDefNameProperty (Tree t, Tree &id)
 Indicates the identifier (if any) the expression was a definition of.
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 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 99 of file eval.cpp.

References pushMultiClosureDefs().

00100 {
00101     return a2sb(eval(boxIdent("process"), nil, pushMultiClosureDefs(eqlist, nil, nil)));
00102 }

bool getDefNameProperty ( Tree  t,
Tree id 
)

Indicates the identifier (if any) the expression was a definition of.

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

Parameters:
t the expression
id reference to the identifier
Returns:
true if the expression t was a definition of id

Definition at line 227 of file eval.cpp.

Referenced by applyList(), evalIdDef(), generateDiagramSchema(), generateInputSlotSchema(), generateInsideSchema(), generateOutputSlotSchema(), legalFileName(), real_a2sb(), and writeSchemaFile().

00228 {
00229     //cerr << "getDefNameProperty of : " << t << endl;
00230     return getProperty(t, DEFNAMEPROPERTY, id);
00231 }

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 1096 of file eval.cpp.

References addLayerDef(), and pushNewLayer().

Referenced by applyList(), iteratePar(), iterateProd(), iterateSeq(), iterateSum(), and real_a2sb().

01097 {
01098     Tree lenv2 = pushNewLayer(lenv);
01099     addLayerDef(id, def, lenv2);
01100     return lenv2;
01101 }

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 1136 of file eval.cpp.

References CTree::branch().

01137 {
01138     // search the environment until a definition is found
01139     // or nil (the empty environment) is reached
01140     while (!isNil(lenv) && !getProperty(lenv, id, def)) {
01141         lenv = lenv->branch(0);
01142     }
01143     return !isNil(lenv);
01144 }

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 598 of file eval.cpp.

00599 {
00600     Tree num;
00601     if (!getNumericProperty(value,num)) {
00602         if (!isBoxNumeric(value,num)) {
00603             num = value;
00604         }
00605         setNumericProperty(value,num);
00606     }
00607     return num;
00608 }


Generated on Sun Mar 22 16:16:01 2009 for FAUST compiler by  doxygen 1.5.8