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

Add module system #10

Merged
merged 8 commits into from
Aug 6, 2017
Merged

Add module system #10

merged 8 commits into from
Aug 6, 2017

Conversation

smpoulsen
Copy link
Owner

No description provided.

Adds `car` and `cdr` for destructuring lists.

Adds `empty?` to check for an empty list

Starts build of terp prelude with `fold_list` and `sum` and `length` implemented
in terms of `fold_list`.
Also fixes a parse error that was preventing empty lists from being valid inputs.
Will remove others in a later commit.

These end up not being necessary if the terms are just parsed and tagged in one
of the value parsers. Minor tweaks needed in other files that were expecting the
parsed tree to be shaped slightly differently, but nothing too major.
Modeling off of Racket; `require` to import a module.
This was going to introduce `provide`, but after getting one passing test,
they've all failed. Realized that there isn't a good mechanism in place with
this approach to 'compile' functions that are exported from a module that may
depend on a function that is private.

Opting for now to make all functions public when importing. There will be
namespace pollution; not sure best approach right now.
Now functions must be explicitly provided to be used when imported.
@smpoulsen smpoulsen force-pushed the add-initial-prelude branch from ac8502c to d114d30 Compare August 5, 2017 18:26
Discovered when importing a module that only defined a single function.
@smpoulsen smpoulsen changed the title Add initial prelude Add module system Aug 6, 2017
@smpoulsen smpoulsen merged commit 608c9e0 into master Aug 6, 2017
@smpoulsen smpoulsen deleted the add-initial-prelude branch August 6, 2017 02:59
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.

1 participant