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

Write canonicalizer for Racket core dataset #12

Closed
rrnewton opened this issue Oct 28, 2016 · 2 comments
Closed

Write canonicalizer for Racket core dataset #12

rrnewton opened this issue Oct 28, 2016 · 2 comments
Assignees

Comments

@rrnewton
Copy link
Member

rrnewton commented Oct 28, 2016

This can be a simple racket program that reads in the current batch of expaded data and produces something in a reduced grammar. This reduced grammar will have a direct interpretation as an algebraic type in our language.

Proposal from slack:

(1) I propose that we emphasize "expr" and squish away all top-level / module-related forms to the following:

(data prog [prog (list toplvl)])
(data toplvl
      [define-values (list Sym) expr]
      [define-syntaxes (list Sym) expr]
      [expression expr])
(data expr [VARREF Sym] [plain-lambda ...]...)
(data formals
      [F1 (list Sym)]
      [F2 (list Sym) Sym]
      [F3 Sym])

(2) we keep all the constructors of "expr" in the same order as the Racket docs, and that determines their tags, starting with 0

(3) for our own purposes we introduce the tags VARREF, F1, F2, F3 above, which are not part of the original grammar

(4) we build-in a notion of list fields in our ASTs, e.g. (list Sym). Worst-case they could be new, packed cons-list datatypes, but we can do better if we bake them in.

(5) by convention we strip all occurrences of #% prefixes in tags

@rrnewton
Copy link
Member Author

1st shot at defining a standard grammar for the canonicalized rep -- 775b946

@samth
Copy link
Member

samth commented Oct 31, 2016

I slightly modified the grammar, and implemented this in rewrite.rkt.

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

No branches or pull requests

2 participants