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

support multiple top-level expressions #5

Closed
wants to merge 1 commit into from
Closed

support multiple top-level expressions #5

wants to merge 1 commit into from

Conversation

apaleslimghost
Copy link
Contributor

No description provided.

@fwg
Copy link
Owner

fwg commented Nov 13, 2014

I just realized one can do "multiple" expressions by just wrapping the input passed to the parser in parentheses, like '('+input+')'. Because, hehe, S-expressions are just lists, and multiple expressions would just be a list of lists.

@fwg
Copy link
Owner

fwg commented Nov 13, 2014

Also, doing the wrap on the caller's side makes it much more explicit that you expect to get back an array as the top-level "AST node". Returning either the single expression or a list of expressions would require to somehow tell (a b) and 'a b' input apart, where a and b are expressions.
Unfortunately, arrays can not have the primitive/Object-instance trick like strings do for discerning symbols and strings.

@apaleslimghost
Copy link
Contributor Author

Good point, didn't think of that.

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.

2 participants