0

I am currently writing a transpiler from a Domain specific language to Fortran in Haskell. I have been able to implement a parser and have managed to generate an abstract syntax tree.

I have reviewed this question about code generation in Haskell and tried the list of suggested libraries to no avail. How much time would you all estimate that constructing a Fortran pretty printer in Haskell would require?

Daniel Wagner
  • 145,880
  • 9
  • 220
  • 380
Talmsmen
  • 183
  • 1
  • 7
  • 1
    This will depend a lot on what big a subset of Fortran you need to implement, and how “pretty” it needs to be. (_Is there such a thing as pretty Fortran?_) — I implemented a parser for a subset of Fortran at one point, but it was very domain-specific. That worked easy enough, however it was all a pretty hacky ad-hoc project. – leftaroundabout Jun 12 '22 at 22:37
  • Your question about whether there are existing libraries is off-topic here; I've removed it to protect you from the question getting closed. – Daniel Wagner Jun 13 '22 at 01:20

1 Answers1

2

I think 2-3 minutes per constructor in your AST should be achievable. (Many will be much quicker; but some will require looking something up or thinking for a bit.) Figure in a bit of set-up time for choosing a reasonable pretty-printer library, working out whatever kinks there are with building it, and spending some quality time with the documentation, a few extra hours in all seems reasonable.

Don't forget to multiply by 1000 because programmers are trash at time estimates.

Daniel Wagner
  • 145,880
  • 9
  • 220
  • 380