haskell / happy

The Happy parser generator for Haskell
Other
276 stars 85 forks source link

Create the 'Tables' data type #203

Closed int-index closed 2 years ago

int-index commented 2 years ago

This data type encapsulates the result of processing the Grammar.

In addition to ActionTable and GotoTable, it also includes intermediate results such as Lr0Items, which are needed for debug printing and info table generation.

The find_redundancies function has been moved from Main.lhs to Tabular.lhs almost verbatim (use git show --color-moved=blocks to confirm).

Ericson2314 commented 2 years ago

I definitely like genTables over runTabular, but do we want to go from the function param to the glr boolean? I thought happy-tabular was supposed to be somewhat agnostic to the parsing strategy --- must maybe that's a impossible/nonsensical ideal so the glr bool is fine?

int-index commented 2 years ago

Sure, I can revert that bit.

Ericson2314 commented 2 years ago

Thanks. I took a look at https://github.com/simonmar/happy/pull/200 to confirm and indeed the GLR stuff was pretty well separated in the end, so that goal does look attainable.

int-index commented 2 years ago

Well, #200 uses a Bool flag too, I used it as a reference.

Ericson2314 commented 2 years ago

@int-index Ah I see. Yes, you were very right to demand we make the diffs readable. These things slipped past me.

Ericson2314 commented 2 years ago

Also, btw, I am rebasing #200 on master and then this to queue up the next steps, so you can just worry about this for the moment.

knothed commented 2 years ago

Nice! So do we want to merge #200 on top of this?

int-index commented 2 years ago

Definitely some parts of #200, since it introduces the .cabal files and so on.

knothed commented 2 years ago

Okay, will you and @Ericson2314 do this? I would then after #200 is merged follow up with the next MR concerning the frontend and backend.

Also, I‘d like to make some more grammar-related types derive Show, and I’d appreciate it if Grammar would contain hd and tl fields so we wouldn’t always have to pass them separately. Can we integrate this in #200 or should this be a follow-up MR?

Ericson2314 commented 2 years ago

@knothed see what I wrote in https://github.com/simonmar/happy/pull/200#issuecomment-932634187. I am adding a little checklist to that PR.