Initializing help system before first use

problem.preparseformula

problem.preparseformula


Purpose
Perform an initial scan of a formula written as a character string, identifying the operators but not attempting to identify the types of the individual tokens
Synopsis
(type, value, stringtable) = problem.preparseformula(formula)
Arguments
formula 
Character string containing the formula, written in the same free-format style as formulae in Extended MPS format, with spaces separating tokens.
type 
Array of token types providing the parsed formula.
value 
Array of values corresponding to the types in Type.
stringtable 
Character buffer to receive the names of the unidentified tokens.
Example
The following example converts the formula "sin(x+y)" into internal parsed format without trying to identify the tokens apart from operands and numbers, and then writes it out as a sequence of tokens.
(type, value, stab) = p.preparseformula("sin ( x + y )")

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

Only operands and numbers are identified by preparseformula. All other operands, including names of variables, functions are left as strings of type xslp_op_unknown. The Value of such a type is the index in stringtable of the start of the token name.

The parsed formula can be converted into a calculable formula by replacing the xslp_op_unknown tokens by the correct types and values.


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.