-
Notifications
You must be signed in to change notification settings - Fork 2
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
Syntax for parsing Rust #1
Conversation
bf9be40
to
2d0f87a
Compare
6c91bbe
to
aeff8a8
Compare
There was a problem hiding this 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.
Sorry that I didn't review all the rust syntax definition.
Since the tests are parsing, I am assuming, the defnition is working well.
Good to merge.
clean: | ||
rm -r .build | ||
|
||
build: $(RUST_TIMESTAMP) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure what is missing on my local machine, but make build
and make test
produces msg: "make: Nothing to be done for `build'.".
But running $(which kompile) rust-semantics/rust.md -o .build/rust-kompiled
builds the semantics.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That should only happen if you already built the semantics and successfully run the tests... Could you make clean
or rm -r .build
and try again?
rust-semantics/syntax.md
Outdated
syntax InnerAttribute ::= "#![" Attr "]" [symbol(innerAttribute)] | ||
syntax OuterAttribute ::= "#[" Attr "]" [symbol(outerAttribute)] | ||
|
||
syntax Attr ::= Identifier |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems, Attr
syntax is defined with SimplePath
(line 92), would you share the reason of not using SimplePath
in the sort definition?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure, I fixed it.
```k | ||
|
||
syntax Module ::= MaybeUnsafe "mod" Identifier ";" | ||
| MaybeUnsafe "mod" Identifier "{" InnerAttributes Items "}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A comment rather than a review.
InnerAttributes Items
is crate
, not sure why the definition in rust reference book is not using crate
here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My guess is that they wanted the "crate" non-terminal to match the meaning of the word "crate" as used in the Rust documentation, which, IIRC, is either "source code file" or something close to that.
rust-semantics/syntax.md
Outdated
syntax MaybeSimplePathWithColon ::= "::" | SimplePath "::" | ||
syntax MaybeUseTreesMaybeComma ::= "" | UseTrees | UseTrees "," | ||
syntax UseTrees ::= UseTree | ||
syntax UseTrees ::= UseTree "," UseTrees |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would non-empty syntactic list useful here, for line 123 and 124.
syntax UseTrees ::= NeList{UseTree, ","}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed here and in many other places.
No description provided.