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

Add String and String Literals #5

Open
mariari opened this issue Apr 15, 2022 · 0 comments
Open

Add String and String Literals #5

mariari opened this issue Apr 15, 2022 · 0 comments

Comments

@mariari
Copy link
Member

mariari commented Apr 15, 2022

We should support string and string literals

Strategies

Using Arrays

One way to compile strings is to have a byte array of ascii values, where each character is represented by their numerical value (E.G. #\D = 100).

packing by byte concatenation

Another interesting technique, if the array is inefficinet. Is to pack the string bitwise. E.G:

"df"
;; this is really
'(100 102)

;; We can now pack this into one elemnt by bit shifting the 100
;; and adding the 102 to the bitshifted value, concatenating them!
(cl:+ (ash 100 7) 102)
#b110010 01100110

However it needs to be noted that we should know the field size, and make sure we don't overflow this when shifting. Thus we should have a small array of these values if we do go over size

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