Search code examples
syntaxpascalabstract-syntax-treebnf

Call function without assigning returning value based on syntax diagram


From Peter Grogono's "Programming in PASCAL" Addison Wesley 1980, a statement is defined as:

enter image description here enter image description here

In this diagram, I don't see how I can call the function as a statement; the only way to call it is to make a new temporary variable, then assign it with the desired function as an expression.

How can I call function without assigning the returning value?


Solution

  • After reading Pascal ISO 7185:1990 specs, I see that Pascal doesn't support function-statement. So the only way to call them is by using temporary variables.

    simple-statement =
          empty-statement
        | assignment-statement
        | procedure-statement
        | goto-statement