fortran-src
fortran-src copied to clipboard
WIP: Qualified fortran version
I'm starting work to allow having CompilerOption list to describe the introduced QualifiedFortranVersion, which will enable supporting DecStructure option.
Looking for maintainers feedback if this is right approach?
As of now, I'd like to get things to work back, which should be done by adjusting Parser.hs and maybe some more things in Main.hs, and later revise the new symbol names, which right now, may not be what we ultimately want.
If a maintainer want to look at the remaining type check error and suggest the right approach, as it is not clear to me at this stage.
Once this compile, I have a bit more work in the lexer to also have the TRecord token and maybe other things.
todo:
- [x] structure / endstructure in the lexer
- [ ] record declaration in the lexer
- [ ] non standard attributes in the lexer
[allocate] - [ ]
.field access in the lexer - [ ] figuring out the rest
related: #303
Ok, I succeeded in flowing the entry point options down to the parsers, now I'm facing some challenge to understand what I should do in the free form lexer, to support the /MyStructName/ that comes right after the structure keyword.
In the fixed form lexer I see:
https://github.com/camfort/fortran-src/blob/b8a490fca804f5f512195417af369834629b6710/src/Language/Fortran/Parser/Fixed/Lexer.x#L232
and the free form lexer:
https://github.com/camfort/fortran-src/blob/b8a490fca804f5f512195417af369834629b6710/src/Language/Fortran/Parser/Free/Lexer.x#L319
https://github.com/camfort/fortran-src/blob/b8a490fca804f5f512195417af369834629b6710/src/Language/Fortran/Parser/Free/Lexer.x#L694-L699
I'm unsure how to proceed, when I've parsed structure should I change context so as to process the "/" differently?
I'd assume this flow:
[TStructure, TSlash, TId "MyStructName", TSlash, ...]
What do those contexts mean:
https://github.com/camfort/fortran-src/blob/b8a490fca804f5f512195417af369834629b6710/src/Language/Fortran/Parser/Monad.hs#L33-L40
I'll look more at this test and try to add one for free form:
https://github.com/camfort/fortran-src/blob/b8a490fca804f5f512195417af369834629b6710/test/Language/Fortran/Parser/Fixed/LexerSpec.hs#L270-L274
Wondering if we want to separate the QualifiedFortranVersion, which changes a bunch of signatures for the "already instanciated parsers" and the rest of the change I started working on (supporting option in QualifiedFortranVersion to parse the structure / record declarations in >= Fortran 90).