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

Introduce a Q::Compunit type #20

Closed
2 tasks done
masak opened this issue Sep 3, 2015 · 2 comments
Closed
2 tasks done

Introduce a Q::Compunit type #20

masak opened this issue Sep 3, 2015 · 2 comments

Comments

@masak
Copy link
Owner

masak commented Sep 3, 2015

Q::Compunit would basically be very similar to Q::Literal::Block.

Right now the compunit is added at the last moment as the program is run.

    my $compunit = Val::Block.new(
        :$statements,
        :outer-frame(self.current-frame));
    self.enter($compunit);

Also, the Q::Statements type gets to hold the static lexpads, simply because there's no higher level to put it because we're missing a root level above statements to hang it on.

The AST tests would all need to be modified, but in a very mechanical fashion.

  • add back Q::CompUnit
  • put the static lexpads on blocks, not statementlists
@masak
Copy link
Owner Author

masak commented Oct 8, 2015

Or, better yet, instead of putting a root compunit node in all of the AST specifications, we just modify the read() sub in 007::Test. That way, we wouldn't even need a compunit mapping in %qclass_lookup — not unless we wanted to check for erroneous things, anyway.

masak pushed a commit that referenced this issue Oct 8, 2015
Conceptually, a Q::Compunit has to be the root of any valid program.

Q::Compunit is a kind of Q::Statement::Block (in that it's this
"invisible block" that surrounds the whole compilation unit). But
since it's not an *actual* block, it felt wrong for
Q::Statement::Block to consist of a Q::Literal::Block, as it used
to. Refactored it to consist of a Q::Statements instead. Since
we still want a block to actually be there, a little more manual
work now falls on the clients of Q::Statement::Block to create
and enter one.

Addresses #20 but doesn't close it yet, because we've yet to move
the static lexpads up one level, which is possible now that we have
the compunit outermost level.
This was referenced Oct 9, 2015
@masak
Copy link
Owner Author

masak commented Oct 24, 2015

Fun historical fact: Q::CompUnit did exist from the start of 007, but was removed in 39db04a. Now it exists again.

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

1 participant