Skip to content

Internal and external functions

Ivan Kondov requested to merge functions into master

solving issues https://git.scc.kit.edu/jk7683/vre-language/-/issues/3 and https://git.scc.kit.edu/jk7683/vre-language/-/issues/4

Following issues could not (yet) be solved:

  1. The scope of the dummy variables ist not restricted to the expression of the function where they are defined. For this reason the dummies may not have the names of any variables in the global scope. This is checked.

  2. Recursive functions can be parsed and checked. However typing and evaluation is currently not possible.

  3. Function calls containing function calls are fully supported. However, function definitions containing function calls result in very difficult evaluation and typing. In particular the parameter of the embedded call cannot be substituted by the parameter of the function if the parameter of the embedded call is the reference to a dummy. Brackets around the dummy creates an epxression and thus it is substituted.

    sqr(x) = x*x
    one_minus_sqr(y) = sqr((y)) # note the (y) to make an expression from the Dummy
    a = one_minus_sqr(2) # the value of parameter is 2
  4. With the example above the evaluation cannot be performed if the order is different:

    sqr(x) = x*x
    a = one_minus_sqr(2) # the value of parameter is 2
    one_minus_sqr(y) = sqr((y))

    This gives rise to this error: AttributeError: 'str' object has no attribute 'value' where the string is the function call expression that is not correctly initialized.

Edited by Ivan Kondov

Merge request reports