Skip to content
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

Abstract First-Class Citizens #4

Closed
giovinazzo-kevin opened this issue Jun 13, 2022 · 1 comment · Fixed by #12
Closed

Abstract First-Class Citizens #4

giovinazzo-kevin opened this issue Jun 13, 2022 · 1 comment · Fixed by #12
Assignees

Comments

@giovinazzo-kevin
Copy link
Owner

giovinazzo-kevin commented Jun 13, 2022

All abstract terms can be represented canonically as a base term.

There should be an interface that allows defining new types in C# as long as a conversion to and from their canonical form is provided.
This interface would also expose the parser, which is currently not extensible, for the purposes of parsing the new type.

After this change is implemented, Dicts and possibly Lists should be rewritten to be abstract first class citizens.

@giovinazzo-kevin giovinazzo-kevin self-assigned this Jun 13, 2022
@giovinazzo-kevin giovinazzo-kevin changed the title Abstract Terms As First-Class Citizens Abstract First-Class Citizens Jun 13, 2022
@giovinazzo-kevin
Copy link
Owner Author

giovinazzo-kevin commented Jun 16, 2022

Infrastructure

  • Created the IAbstractTerm interface that handles conversion to canonical form, explanation and unification logic
  • Created the AbstractTermParser<T> abstract class and the IAbstractTermParser untyped interface
  • Added parameter Action<Parser> configureParser where necessary
  • Added method Parser.TryAddAbstractParser<T>(AbstractTermParser<T> parser)
  • Modified ITerm to have a Maybe<IAbstractTerm> AbstractForm

Changes

  • Implemented and standardized lists through the AbstractList IAbstractTerm and the ListParser<T>. The new types are: List, Set (formerly BracyList), CommaList and, for internal use, UntypedList
  • Reimplemented Dict as an abstract term through the new interface and made it depend on the Set parser
  • Modified unification and explanation logic to account for abstract terms

Bugs

Some bugs pertaining to list unfolding may still be in hiding at the moment.

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

Successfully merging a pull request may close this issue.

1 participant