Skip to content

Conversation

smoothdeveloper
Copy link
Contributor

@smoothdeveloper smoothdeveloper commented Feb 15, 2025

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:

  • 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

  bump singletons-* packages in order to build on recent ghc / cabal
  define unescapeSpecialChars in LexerUtils.hs
  use unescapeSpecialChars on the fail call, when the lexing aborts, which makes the output in the console more readable to end user
…ersion (either vanilla or qualified with options), and defining DecStructure CompilerOption.

Done most of the plumbing to get the lexer compilation errors cleared and the new predicate, but hitting a stumbling block for now, on all the parser instantiations, higher order / curried symbols.
@smoothdeveloper
Copy link
Contributor Author

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:

<st,iif> "/" { addSpan TSlash }

and the free form lexer:

<scN> "/" { slashOrDivision }

slashOrDivision :: LexAction (Maybe Token)
slashOrDivision = do
context <- topContext
case context of
ConData -> addSpan TSlash
_ -> addSpan TOpDivision

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:

data Context =
ConStart
| ConData
| ConImplicit
| ConNamelist
| ConCommon
deriving (Show, Eq)

I'll look more at this test and try to add one for free form:

resetSrcSpan (collectFixedTokens' Fortran77Legacy src)
`shouldBe` resetSrcSpan [ TStructure u, TSlash u, TId u "foo", TSlash u, TNewline u
, TUnion u, TNewline u
, TMap u, TNewline u
, TType u "integer", TId u "i", TNewline u

@smoothdeveloper
Copy link
Contributor Author

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant