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

userdata in AST #31

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

userdata in AST #31

wants to merge 2 commits into from

Conversation

mattn
Copy link

@mattn mattn commented Jun 1, 2015

mpc doesn't have userdata in AST. so we should parse strings in each times while walking AST.

For example: https://github.com/mattn/orelang/blob/master/ore.c#L1236
since parsing in each times, it's very slow.

@mattn
Copy link
Author

mattn commented Jun 1, 2015

And I'm thinking, since mpc provide tag as string, we should look what this node is string or number, etc in walking tree every times.

@orangeduck
Copy link
Owner

Hey,

I agree it would be nice to let the user use non-string tags of some sort - at least for performance reasons as you mention.

Even better would be a way to let the user give their own AST type to be used with the language parser and a bunch of callback functions to be called for the various operations such as adding children, tagging or deletion.

Then we can just let mpc_ast_t be the default AST type for people who don't need that functionality and for people who want to make a custom AST type that is faster they can.

I'll have a think about it some more.

  • Dan

@mattn
Copy link
Author

mattn commented Nov 3, 2015

Hi, sorry about delay. Any thought?

@orangeduck
Copy link
Owner

Hi mattn,

Thanks for the reminder. I'll try to make this update soon. I was put off because the code for parsing the ast is kind of a mess because it does lots of auto-merging of nodes depending on various conditions so I'll have to try and separate that out.

  • Dan

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.

None yet

2 participants