Name:

parse parses an expression contained in a string

Library name:

sollya_obj_t sollya_lib_parse(sollya_obj_t)

Usage:

parse(string) : string -> function | error

Parameters:

Description:

Example 1:

   > parse("exp(x)");
   exp(x)

Example 2:

   > text = "remez(exp(x),5,[-1;1])";
   > print("The string", text, "gives", parse(text));
   The string remez(exp(x),5,[-1;1]) gives 8.7381909882756203676868315731687604903964388498642e-3 * x^5 + 4.3793696379596015478233171265365272893795005588381e-2 * x^4 + 0.16642465614952768185129433844012193925654065755905 * x^3 + 0.49919698262963614991826575452094101562044819693772 * x^2 + 1.00003834650599815466340068058231011540878088492516 * x + 1.00004475029559502606203712816558243384077522932213

Example 3:

   > verbosity = 1!;
   > parse("5 + * 3");
   Warning: syntax error. Will try to continue parsing (expecting ";"). May leak memory.
   Warning: the string "5 + * 3" could not be parsed by the miniparser.
   Warning: at least one of the given expressions or a subexpression is not correctly typed
   or its evaluation has failed because of some error on a side-effect.
   error

Example 4:

   > i = 17;
   > parse("i = 42");
   error
   > i;
   17
   > (parse("proc () { i = 42; }"))();
   > i;
   42
See also: execute, readfile, print, error, dieonerrormode, proc
Go back to the list of commands