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 functions to manipulate strings. #12

Open
drwhut opened this issue Jan 13, 2020 · 3 comments
Open

Add functions to manipulate strings. #12

drwhut opened this issue Jan 13, 2020 · 3 comments
Labels
feature A new feature to consider.
Milestone

Comments

@drwhut
Copy link
Owner

drwhut commented Jan 13, 2020

For example, Concatenate.

@drwhut drwhut added the feature A new feature to consider. label Jan 13, 2020
@drwhut
Copy link
Owner Author

drwhut commented Jan 16, 2020

Length was trivial to implement, but there is a problem with implementing functions like Concatenate - some strings in the bytecode point directly to strings in the .data section, some point to external malloc'd strings (e.g. string variables), and there's no way to know which is which. Best course of action would probably be to wait for #5 to be resolved first.

@drwhut drwhut mentioned this issue Jan 16, 2020
@drwhut
Copy link
Owner Author

drwhut commented Jan 20, 2020

Maybe it is best if strings are immutable? When using a function like Concatenate, it should make a new string. This would mean the VM would have to keep track of malloc'd strings and free them after they are used.

@drwhut
Copy link
Owner Author

drwhut commented Feb 19, 2020

Since the new stack-based VM has been implemented, I will make it so each item in the stack has a flag to say whether it should be freed when it is popped from the stack. The same would go for string variables.

@drwhut drwhut added this to the v0.4.0 milestone Feb 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature A new feature to consider.
Projects
None yet
Development

No branches or pull requests

1 participant