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

break the compiler up and have it configurable #66

Merged
merged 17 commits into from
Jun 10, 2015

Conversation

jimmyhchan
Copy link
Collaborator

** Tests pass! **

use multiple passes for the compiler (like https://github.com/pegjs/pegjs/tree/master/lib/compiler/passes).

The heart of this can be seen in:

blocks: {},
state: STATES.OUTER_SPACE
compile(ast, name, options) {
let passes = options && options.passes || defaultPasses;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any way we could merge with default passes instead of overriding them?

start.bodies = bodies;
start.body = h;
start.bodies.unshift(['TORNADO_BODY', {name: null, type: 'bodies', body: contents}]);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we give the default body a name (maybe default or main) so that it can be more easily referenced in helpers.

@jimmyhchan
Copy link
Collaborator Author

See the latest push

I got the walker going correctly now (https://github.com/jimmyhchan/tornado/blob/extensible/src/compiler/visitor.js)

I put a visualizing pass (https://github.com/jimmyhchan/tornado/blob/extensible/src/compiler/passes/visualize.js) and that looks correct.

I combined the default body into bodies.

So as it is right now: the AST is solid, the vistor and compiler passes work as expected. We just need to get the generate code doing what we expect.

@smfoote can I get your thoughts.

@jimmyhchan
Copy link
Collaborator Author

updated pull request thanks

@jimmyhchan jimmyhchan changed the title [WIP] - break the compiler up and have it configurable break the compiler up and have it configurable Jun 9, 2015
@smfoote
Copy link
Owner

smfoote commented Jun 10, 2015

I forgot to delete the unneeded code from generateJS.js. Can you delete that code before we merge?

const PRODUCTION = 'production';
'use strict';
import Context from './compiler/context';
// import preprocess from './compiler/passes/preprocess';
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we remove this line, and the related file. It's not necessary anymore.

@jimmyhchan
Copy link
Collaborator Author

see the last 2 commits. i think that covers the comments.

return template;
})();`;
};
export let createMethodFooters = function(name, context) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method can be removed now (it's a part of generateJS.js now)

smfoote added a commit that referenced this pull request Jun 10, 2015
break the compiler up and have it configurable
@smfoote smfoote merged commit 5c92753 into smfoote:master Jun 10, 2015
@jimmyhchan jimmyhchan deleted the extensible branch June 10, 2015 22:58
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