Skip to content

Create the 'Tables' data type #203

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 1, 2021
Merged

Conversation

int-index
Copy link
Collaborator

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
Copy link
Collaborator

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
Copy link
Collaborator Author

Sure, I can revert that bit.

@Ericson2314
Copy link
Collaborator

Ericson2314 commented Oct 1, 2021

Thanks. I took a look at #200 to confirm and indeed the GLR stuff was pretty well separated in the end, so that goal does look attainable.

@int-index
Copy link
Collaborator Author

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

@Ericson2314
Copy link
Collaborator

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

@Ericson2314
Copy link
Collaborator

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.

src/Tabular.lhs Outdated
Find unused rules and tokens

> find_redundancies
> :: (LRAction -> [Int]) -> Grammar -> ActionTable -> ([Int], [String])
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
> :: (LRAction -> [Int]) -> Grammar -> ActionTable -> ([Int], [String])
> :: SelectReductions -> Grammar -> ActionTable -> ([Int], [String])

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I couldn’t decide whether to use the type synonym or to keep the type signature verbatim when copying.

Alright, let’s change this one :-)

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).
@int-index int-index merged commit cfa99bd into haskell:master Oct 1, 2021
@knothed
Copy link
Contributor

knothed commented Oct 1, 2021

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

@int-index
Copy link
Collaborator Author

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

@knothed
Copy link
Contributor

knothed commented Oct 1, 2021

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
Copy link
Collaborator

@knothed see what I wrote in #200 (comment). I am adding a little checklist to that PR.

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.

3 participants