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

SubX in SubX: Transforming uses of string literals (prerequisite A) #26

Merged
merged 11 commits into from
May 16, 2019

Conversation

akkartik
Copy link
Owner

One of two primitives remaining to be built in dquotes.subx.

For more context, see the parent branch.

@akkartik akkartik added the in progress Feature branch; may not work; not ready for merging label Apr 29, 2019
Converting literal strings into bytes in the data segment.
Operations on buffered-file now always include the word 'buffered'. More
verbose, but hopefully this highlights holes in the library.
These are variants of write-byte-buffered and print-byte-buffered respectively
that operate on in-memory `stream`s rather than `buffered-file`s.

They don't operate on files, so we'll avoid using the prefix 'write-'.
Convert raw literal strings (no escape sequences) to the data segment.
Segfault in this branch is now fixed.
@akkartik
Copy link
Owner Author

@charles-l The segfault in this branch should now be fixed. Can you confirm?

dquotes.subx is now segfaulting after this merge. Seems to be trying to
use addresses from the old stack.
How did things seem to be working until now?
- We were saving an address from the stack to stream.read
- When we read this address in skip-chars-matching:loop, we used to stop early

But now we've moved the stack to a larger address, one where the most significant
byte is set. When the stack address now gets to skip-chars-matching:loop,
it's treated as a negative number and we proceed through the loop. At which
point we try to index into the array using it.

No real test to be written to protect against this :(
Still some failing tests:
  - emit-string-literal-data doesn't ignore metadata when computing the
    length of literal strings
  - emit-string-literal-data doesn't handle escape sequences

One issue doesn't have a failing test:
  - emit-metadata doesn't handle string literals containing '/'

All these open issues involve a common design question: how to parse a
'word' that includes a string literal that may include spaces.

For everything else I know words can't contain spaces and datums can't
contain slashes. But for string literals things are tougher.
@akkartik
Copy link
Owner Author

I've gotten dquotes.subx to some sort of milestone and am going to merge the existing PRs. We have a design problem, and all these branches and PRs now seem like a hindrance. Let's get to a clean working state on master and confirm that the old segfaults are all gone. Then we need to come up with a new design.

The design problem is outlined in this commit message: 438e5a0

@akkartik akkartik merged commit 79ff556 into dquotes May 16, 2019
@akkartik akkartik removed the in progress Feature branch; may not work; not ready for merging label May 18, 2019
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