grammarware / software-evolution

Software Evolution
MIT License
1 stars 0 forks source link

PROCEDURE DIVISION, paragraph required or not? #13

Closed eefscheef closed 5 months ago

eefscheef commented 5 months ago

The graphic at https://slebok.github.io/baby/proceduredivision.html seems to indicate that at least one paragraph is required in a procedure division. However, many of the provided test cases only include one or more sentences in the PROCEDURE DIVISION without adding a paragraph with its corresponding identifier. Simple example would be

IDENTIFICATION DIVISION. PROCEDURE DIVISION. DISPLAY M.

from the recombined test test_403488.baby

Right now I'm following the test cases and set paragraphs to entirely optional, but that seems to contradict the diagram. Am I misinterpreting it?

grammarware commented 5 months ago

Thanks for pointing out the inconsistency! +1 XP for your group, and the documentation is updated accordingly.

There can be sentences outside the paragraph (or before the first paragraph), and there can be any number of paragraphs (including zero), so it is legal to even have a completely empty PROCEDURE DIVISION (which is also legal in COBOL, even though there it is also somewhat more complex because divisions can have sections too).

eefscheef commented 5 months ago

Thanks for the quick response!