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

Number literals need to be tokenized #8

Open
dsamarin opened this issue Oct 7, 2011 · 1 comment
Open

Number literals need to be tokenized #8

dsamarin opened this issue Oct 7, 2011 · 1 comment

Comments

@dsamarin
Copy link
Member

dsamarin commented Oct 7, 2011

Number tokenizing is very long and complex. As of now there isn't a suitable token type for them. The long long needs to be represented with 64-bit integers, which JS does not support natively.

Here's some old code with doesn't tokenize, but goes through the basic steps of tokenizing. It is untested.
https://github.com/oftn/coca/blob/4ac315fb329a09871277bbe3a033dc79488993c6/CParse.js

@devyn
Copy link
Member

devyn commented Oct 7, 2011

We probably won't be able to support long long for a little while, but when we do I would use an object like:

{ size: 64, hi: 0xFF, lo: 0x432 } = 0x000000FF00000432

We'd have to do a few complex things though, like implementation of the Karatsuba algorithm for multiplication.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants