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

Support for str.< and str.<= #109

Merged
merged 6 commits into from
Nov 30, 2023
Merged

Support for str.< and str.<= #109

merged 6 commits into from
Nov 30, 2023

Conversation

vhavlena
Copy link
Collaborator

Basic support for predicates str.< and str.<=. Implemented using to_code function.

@vhavlena vhavlena linked an issue Nov 24, 2023 that may be closed by this pull request
@vhavlena vhavlena marked this pull request as ready for review November 24, 2023 07:40
@vhavlena vhavlena requested review from jurajsic and Adda0 November 24, 2023 07:40
Copy link
Collaborator

@Adda0 Adda0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. I will approve when the discussions are resolved.

Comment on lines 433 to 435
if(!this->m_conversion_todo.empty()) {
return false;
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this do?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It means that underapproximation will not turn on if we have any to_code/from_code/to_int/from_int. Is there any reason we want to turn it off? If yes, add a comment.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, when I thought about it, it seems to me that it should work for the conversions.

Copy link
Member

@jurajsic jurajsic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it does not work correctly yet, did you try it on any examples?

* x < y & x != eps -> x = u.v1.w1
* x < y & x != eps -> v1 in re.allchar
* x < y & x != eps -> v2 in re.allchar
* x < y & x != eps -> to_code(v1) + k = to_code(v2) & k >= 1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is overly convoluted, you can just do to_code(v1) < to_code(v2).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really. There is some sad story inside the function.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, that is weird. Maybe it becomes nonlinear because to_code is a function? But still, does not make sense if your hack works.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, thats strange.

Comment on lines 433 to 435
if(!this->m_conversion_todo.empty()) {
return false;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It means that underapproximation will not turn on if we have any to_code/from_code/to_int/from_int. Is there any reason we want to turn it off? If yes, add a comment.

@vhavlena
Copy link
Collaborator Author

@jurajsic @Adda0 Hopefully I resolved all the issues. Can you check it?

Copy link
Collaborator

@Adda0 Adda0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

@vhavlena vhavlena merged commit 8c9fc25 into devel Nov 30, 2023
@vhavlena vhavlena deleted the lex-support branch November 30, 2023 17:05
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.

Add support for str.< and str.<=
3 participants