Upcoming release 24.05

git-svn-id: https://svn.eiffel.com/eiffel-org/trunk@2469 abb3cda0-5349-4a8f-a601-0c33ac3a8c38
This commit is contained in:
eifops
2024-06-03 09:22:03 +00:00
parent 559c525f51
commit 5b930d3032
2960 changed files with 63764 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
[[Property:title|Eiffel polynomial parser]]
[[Property:weight|0]]
[[Property:uuid|63f0e737-4ad7-c574-3bbc-05e005815785]]
In the directory '''$ISE_EIFFEL/examples/parse''' you will find a system that implements a processor for a grammar describing a simple language for expressin polynomials. A typical document in this language is the line
<code>
x;y: x * (y + 8 - (2 * x))
</code>
The beginning of the line, separated from the rest by a colon, is the list of variables used in the polynomial, separated by semicolons. The rest of the line is the expression defining the polynomial. The grammar can be described with the following grammar:
<code>
LINE = VARIABLES ":" SUM
VARIABLES = VAR .. ";"
SUM = DIFF .. "+"
DIFF = PRODUCT .. "-"
PRODUCT = TERM .. "*"
TERM = SIMPLE_VAR | INT_CONSTANT | NESTED
NESTED = "(" SUM ")" </code>
This grammar assumes a terminal '''VAR''', which must be defined as a token type in the lexical grammar. The other terminals are keywords, shown as strings appearing in the double quotes, for example "+".
When compiling the example, the executable '''process(.exe)''' is created. When executing the program, it will prompt for the name of a file with a polynomial description, reads a polynomial from the given file, prompts for integer values of the variables, and evaluates the polynomial.

View File

@@ -0,0 +1,8 @@
[[Property:title|Parse Sample]]
[[Property:weight|2]]
[[Property:uuid|ad48d4f5-a113-65f7-15fc-8c8fd3f5c284]]
* [[Eiffel polynomial parser|Eiffel polynomial parser]]