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

Ziggy changes #81

Open
wants to merge 21 commits into
base: master
Choose a base branch
from
Open

Ziggy changes #81

wants to merge 21 commits into from

Conversation

pefribeiro
Copy link
Contributor

Creating a pull request so it's easier to track changes or add comments on them.

Copy link
Contributor Author

@pefribeiro pefribeiro left a comment

Choose a reason for hiding this comment

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

Hi @zlattala,

I've finished going through the set of changes. I have some questions about the changes in the grammar of RoboChart, whose changes may impact the RoboSim plug-ins.

I also have a few concerns regarding the changes in the validator. The most pressing are those that have been swapped to use 'contains' or 'containsAll'. We cannot, in general, use Java methods of collections to do these checks, because the notion of equality for Java does not match our notion (based on names of eg. variables/types). It's likely that our examples may not be sufficient to show all potential issues with these changes.

Thanks,
Pedro

Comment on lines 546 to 547
IntegerExp: value=INT;
StringExp: value=STRING;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@zlattala why are these necessary here, given they're declared within Atomic?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I believe we discussed this, and it was fine to leave, but just to clarify, it is because ANNParameters requires a StringExp explicitly.

Comment on lines +549 to +553
SeqExp:
{SeqExp}
'<' (
values+=PlusMinus (',' values+=PlusMinus)*
)? '>'; // need this to avoid conflict between greater than and closing sequences
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why has this changed? Before a SeqExp could also be defined by anothe Expression or SetExp. I can't rember why we had that format, but perhaps @alvarohm may be able to comment on that.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I am not sure about this, but I have not changed it for now ^

'requires' rInterfaces+=[Interface|QualifiedName] |
variableList+=VariableList |
events+=Event |
clocks+=Clock
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why are clocks included? Controllers cannot have clocks.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I have removed this now, thanks.

Comment on lines +671 to +690
//Similar definition to RoboSim but no InputContext and OutputContext class.
InputContext returns Context:
{InputContext}
'inputcontext' '{'
(
'uses' interfaces+=[Interface|QualifiedName] |
events+=Event
)*
'}'
;

OutputContext returns Context:
{OutputContext}
'outputcontext' '{'
(
'uses' interfaces+=[Interface|QualifiedName] |
events+=Event
)*
'}'
;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

There's a potential problem here for RoboSim.xtext (which inherits from this) because it also has rules with the same name, and classes in the metamodel of the same name. I'll need to check RoboSim can reuse these before merging this into master.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

RoboSim also uses the syntax 'input' 'context' rather than 'inputcontext', and similarly for outputs. This is a minor detail, perhaps could make it consistent.

/* C3 */
val rVars = getRVars(s)
if (!rVars.forall[x|pVars.exists[v|x.name == v.name && ((v.type === null && x.type === null) || typeCompatible(v.type,x.type))]]) {
if (!pVars.containsAll(rVars)) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure this change is sound. The previous implementation checked variable names and their types. I'm not sure if the type-checker deals with this. May be worth checking we have examples that cover such cases.

Copy link
Collaborator

Choose a reason for hiding this comment

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

This is fixed, and with the new version, robochart success test13 catches this error.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I have made this change, and added a test case for it ^

var vs = ""
var started = false
for (v : rVars) {
if (!pVars.exists[x|x.name == v.name && ((v.type === null && x.type === null) || typeCompatible(v.type,x.type))]) {
if (!pVars.contains(v)) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think this is a sound change either. We cannot use the builtin Java methods otherwise we'll be comparing containment based on Java objects, whose equality notion is different from that of the RoboChart metamodel.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I have made this change ^

val calls = c.eAllContents.filter(Call)
val allOps = calls.map[
val sig = operation
opDef(parent.LOperations.findFirst[OpEqual(sig, it)])
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This may be ok, but see problem above with changes in implementation of OpEquals, which are likely not sound.

var vs = ""
var started = false
for (v : rVars) {
if (!pVars.exists[x|x.name == v.name && ((v.type === null && x.type === null) || typeCompatible(v.type,x.type))]) {
if (!pVars.contains(v)) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sound.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I have made this change ^

@@ -2385,7 +2477,7 @@ https://github.com/UoY-RoboStar/robochart-csp-gen/issues/39',

// recursively collects outputs of a node container, avoiding operations already checked
// it is required by WFC O2 that operations not be recursive, but we can't know that has been checked beforehand
private def HashSet<Event> stmOutputSetInContextRecursive(StateMachineBody stm, Controller context, HashSet<OperationSig> alreadyChecked, StateMachineBody outerstm) {
/*private def HashSet<Event> stmOutputSetInContextRecursive(StateMachineBody stm, Controller context, HashSet<OperationSig> alreadyChecked, StateMachineBody outerstm) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why is this, and the following, commented out? Where is the replacement implementation for this?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I have uncommented this, and removed the replacement code, as discussed.

RoboChartPackage.Literals.CONNECTION__TO,
index
)
if (ncOutputSet(stmDef(c.to as StateMachine)).contains(c.eto)) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why has this been changed?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I have changed this back.

Ziggy and others added 4 commits March 20, 2024 18:07
StringExp.

This seems required, otherwise extensions of the grammar, eg. in
robosim-textual cannot produce valid parsers for some unknown reason. I
suspect it was because of the duplication of action/rules having similar
names.
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.

None yet

2 participants