OCamlPro / gnucobol

A clone of the sourceforge GnuCOBOL compiler from COBOL to C.
https://get-superbol.com
GNU Lesser General Public License v3.0
16 stars 21 forks source link

Try moving Area A checks and handling of missing periods from the parser into the scanner #91

Open nberth opened 1 year ago

nberth commented 1 year ago

For sure the current approach is incomplete and does not cover many cases as you noticed (I think I mentioned this limitation a while ago, but maybe I was not explaining this clearly enough…).

I think working that around properly and in full generality is very tricky with the current pull parser. One approach may be to switch to a push parser whose state may be checked in the scanner when issuing tokens; I tried this at some point, but hit some other problems as this messes up parts of the state that is shared between the scanner and the parser. Going the ad hoc route and adding more manual checks in some places could work, but only in the short term.

Note that moving area A detection to the scanner may require moving the detection of missing periods there as well…

Originally posted by @nberth in https://github.com/OCamlPro/gnucobol/issues/35#issuecomment-1447967530

GitMensch commented 1 year ago

For GC 3.2 the current approach will be kept, so I'm adding a bunch of manual checks that I've found missing. Testing other approaches that may be shipped later sounds like a good thing to do (but seems like a bigger task).