Initializing help system before first use

problem.parseformula

problem.parseformula


Purpose
Parse a formula written as an unparsed array of tokens into internal parsed (reverse Polish) format
Synopsis
ntoken = problem.parseformula (intype, invalue, type, value)
Arguments
intype 
Array of token types providing the unparsed formula.
invalue 
Array of values corresponding to the types in inType.
ntoken 
The number of tokens in the parsed formula (not counting the terminating xslp_op_eof token).
type 
Array of token types providing the parsed formula.
value 
Array of values corresponding to the types in type.
Example
Assuming that x and y are already defined as columns with index iX and iY respectively, the following example converts the formula "sin(x+y)" into internal parsed format, and then writes it out as a sequence of tokens.
intype  = []
invalue = []

intype  = [xslp_op_ifun, xslp_op_lb, xslp_op_col, xslp_op_op,
           xslp_op_col, xslp_op_rb, xslp_op_eof]
invalue = [xslp_op_sin,  0,          iX         , xslp_op_plus,
           iY,          0,          0]

type  = []
value = []

ntoken = p.parseformula (intype, invalue, type, value)

i=0
while type[n] != xslp_op_eof:
  str = p.itemname (type[i], value[i])
  print (str)
  i += 1
Further information

For possible token types and values, see the chapter on "Formula Parsing" in the SLP reference manual.


Related topics

© 2001-2019 Fair Isaac Corporation. All rights reserved. This documentation is the property of Fair Isaac Corporation (“FICO”). Receipt or possession of this documentation does not convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except solely for internal evaluation purposes to determine whether to purchase a license to the software described in this documentation, or as otherwise set forth in a written software license agreement between you and FICO (or a FICO affiliate). Use of this documentation and the software described in it must conform strictly to the foregoing permitted uses, and no other use is permitted.