|
Last change
on this file was 1, checked in by chronos, 6 years ago |
- Added: Modified PL/0 compiler and interpreter for better readability.
|
|
File size:
664 bytes
|
| Line | |
|---|
| 1 | program = block "." .
|
|---|
| 2 |
|
|---|
| 3 | block = [ "const" ident "=" number {"," ident "=" number} ";"]
|
|---|
| 4 | [ "var" ident {"," ident} ";"]
|
|---|
| 5 | { "procedure" ident ";" block ";" } statement .
|
|---|
| 6 |
|
|---|
| 7 | statement = [ ident ":=" expression | "call" ident
|
|---|
| 8 | | "?" ident | "!" expression
|
|---|
| 9 | | "begin" statement {";" statement } "end"
|
|---|
| 10 | | "if" condition "then" statement
|
|---|
| 11 | | "while" condition "do" statement ].
|
|---|
| 12 |
|
|---|
| 13 | condition = "odd" expression |
|
|---|
| 14 | expression ("="|"#"|"<"|"<="|">"|">=") expression .
|
|---|
| 15 |
|
|---|
| 16 | expression = [ "+"|"-"] term { ("+"|"-") term}.
|
|---|
| 17 |
|
|---|
| 18 | term = factor {("*"|"/") factor}.
|
|---|
| 19 |
|
|---|
| 20 | factor = ident | number | "(" expression ")".
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.