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

Some upper bounds? #14

Open
BenWiederhake opened this issue Jun 13, 2018 · 3 comments
Open

Some upper bounds? #14

BenWiederhake opened this issue Jun 13, 2018 · 3 comments

Comments

@BenWiederhake
Copy link
Contributor

Currently, there are no upper bounds in place, for example regarding the macro call stack:

macro function
begin
    function
endmacro
function

This segfaults because the stack grows out of bounds. Adding hardcoded upperbounds, like a depth of 2048 or whatever should suffice.

I'm aware that this is yet another piece of information that needs to be carried around all the time. Maybe putting the variables, macros, hex flag, and stack depth all in a single "context" struct would clean up the function signatures?

@thosakwe
Copy link
Owner

Valid concern, but I'm wondering how necessary it might be in practice. Since t2b isn't a real programming language, I doubt people would be writing functions so recursive that they trigger segfaults.

Though, it might be good to impose bounds just in case.

@thosakwe
Copy link
Owner

And yes, having a context struct would be smarter. I've actually removed hexMode locally, as it's no longer necessary, now that hex/bin/oct literals are in place.

@thosakwe
Copy link
Owner

Plus, there is also now a return keyword.

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

2 participants