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

Fix grammar verifcation #34994

Closed
wants to merge 1 commit into from
Closed

Conversation

dns2utf8
Copy link
Contributor

@dns2utf8 dns2utf8 commented Jul 23, 2016

I wanted to improve the grammar-section but I can not build it.

r? @steveklabnik @brson

EDIT: I resolved some of the issues, removed the compiler output from the entry.

@dns2utf8
Copy link
Contributor Author

I was able to fix the errors, yay 😁 The API of libsyntax was changed (eg 24e7491) but the veryfy.rs is not getting build.

Should we include the antlr4-complete.jar or just build the verify.rs with the compiler? So further changes to the API will triger an error.

@dns2utf8 dns2utf8 changed the title Enhance the spelling of the grammar Fix grammar verifcation Jul 23, 2016
@@ -4,11 +4,11 @@ Uses [antlr4](http://www.antlr.org/) and a custom Rust tool to compare
ASTs/token streams generated. You can use the `check-lexer` make target to
run all of the available tests.

To use manually:
To use manually, assuming antler4 ist installed at `/usr/share/java/antlr-complete.jar`:
Copy link
Contributor

Choose a reason for hiding this comment

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

This should probably say "antlr", not "antler".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, yes thank you 👍

@dns2utf8
Copy link
Contributor Author

dns2utf8 commented Jul 23, 2016

I run the check-lexer target and the result was this:

test result: failed. 4764 passed; 125 failed; 2 skipped

I am curious, what are the next steps to fix the failed tests?

@@ -37,7 +37,7 @@ $(BG):

$(BG)RustLexer.class: $(BG) $(SG)RustLexer.g4
$(Q)$(CFG_ANTLR4) -o $(BG) $(SG)RustLexer.g4
$(Q)$(CFG_JAVAC) -d $(BG) $(BG)RustLexer.java
$(Q)$(CFG_JAVAC) -d $(BG) -classpath /usr/share/java/antlr-complete.jar $(BG)RustLexer.java
Copy link
Member

Choose a reason for hiding this comment

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

hm, is this always going to be where this is? Feels system-specific

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is the place in Arch Linux, but not on Mac OS X. I have not tested other distros.

@steveklabnik
Copy link
Member

@alexcrichton what do you think of this PR?

@alexcrichton
Copy link
Member

It does seems system specific, perhaps that could be refactored? That being said I know very little about all of this, and we don't run it on the bots, so I don't mind merging basically whatever here.

@brson
Copy link
Contributor

brson commented Jul 25, 2016

I'm cool with pushing these improvements through even with the hardcoded path. It's better than it was, and I'm glad somebody is looking at this stuff. Would be good to get this onto a bot #28592

@dns2utf8
Copy link
Contributor Author

The system specific path could be obmittet with an environement variable, so the javac can find the antlr4-complete.jar but this would require the user to set it manually or the configure script to search for it.

Another alternative would be to include the jar file and just ship it. Is this a good idea?

cc: @nikomatsakis

@dns2utf8 dns2utf8 force-pushed the doc_grammar branch 6 times, most recently from 10f7384 to e8f4f4f Compare July 29, 2016 22:00
@dns2utf8
Copy link
Contributor Author

I add the target check-build-lexer-verifier to make tidy, so it will build the verifier with every build and catch future changes in the API.
This does not require javac or antlr.

I think this is a good state freeze/merge for now. I planed to add some documumentation about the process in the next weeks, but I am no sure whether it will be in a good shape before the 18. august or not.

@steveklabnik
Copy link
Member

@bors: r+ rollup

:shipit: now, we can make it better eventually 😄

@bors
Copy link
Contributor

bors commented Aug 3, 2016

📌 Commit 76026d1 has been approved by steveklabnik

sophiajt pushed a commit to sophiajt/rust that referenced this pull request Aug 4, 2016
Fix grammar verifcation

I wanted to improve the [grammar-section](https://doc.rust-lang.org/grammar.html#items-and-attributes) but I can not build it.

r? @steveklabnik @brson

EDIT: I resolved some of the issues, removed the compiler output from the entry.
steveklabnik added a commit to steveklabnik/rust that referenced this pull request Aug 4, 2016
Fix grammar verifcation

I wanted to improve the [grammar-section](https://doc.rust-lang.org/grammar.html#items-and-attributes) but I can not build it.

r? @steveklabnik @brson

EDIT: I resolved some of the issues, removed the compiler output from the entry.
@@ -47,6 +47,10 @@ clean-misc:
$(Q)rm -Rf dist/*
$(Q)rm -Rf doc

clean-grammar:
@$(call E, cleaning grammar verification)
$(Q)cd src/grammar && rm -Rf verify *.class *.java *.tokens
Copy link
Contributor

Choose a reason for hiding this comment

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

This does not handle an out-of-tree build directory, which our bots use.

cleaning grammar verification
/bin/sh: 1: cd: can't cd to src/grammar
/buildslave/rust-buildbot/slave/auto-linux-64-nopt-t/build/mk/clean.mk:51: recipe for target 'clean-grammar' failed
make: *** [clean-grammar] Error 2
program finished with exit code 2
elapsedTime=0.958165

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Interesting, looking on it.

@sophiajt
Copy link
Contributor

sophiajt commented Aug 4, 2016

@bors r-

 * Use make check-lexer to verify the grammar.
 * Extend grammar/README
 * Add make clean-grammar rule
 * Add target check-build-lexer-verifier to make tidy, so it will build the verifier with every build and catch future errors
@dns2utf8
Copy link
Contributor Author

dns2utf8 commented Aug 6, 2016

I moved the in-tree part to the README of the manual process, since it was just for convenience.

I was looking for the structure of the build bot, can I run one locally?

@steveklabnik
Copy link
Member

@alexcrichton ping re last comment here, can @dns2utf8 do something to test this out?

@alexcrichton
Copy link
Member

We've got a number of docker images which our bots are running, so running the tests inside those containers would perhaps be enough to test out?

@dns2utf8
Copy link
Contributor Author

dns2utf8 commented Aug 15, 2016

I was able to start a container and access it with this command:

docker run --rm -it --entrypoint=/bin/bash alexcrichton/rust-slave-linux:2016-08-04

then inside clone my branch like the script:

git clone https://github.com/dns2utf8/rust.git --branch doc_grammar

I can then build my branch:

cd rust
./configure && make -j$(nproc) docs

but I am not sure this is the same as you do.
Am I doing it wrong? @jonathandturner

EDIT: I am doing this, because the setup-slave.sh uses some internal server which I can not reach so I am strongly guessing

@alexcrichton
Copy link
Member

@dns2utf8 yeah that's basically the same as what we do, this'd just be testing for presence of the relevant tools.

Is this running by default on make check though? I thought you had a run a custom check target?

@alexcrichton
Copy link
Member

Closing due to inactivity, but feel free to resubmit with a rebase!

@dns2utf8
Copy link
Contributor Author

dns2utf8 commented Sep 17, 2016

Thanks for the reminder, I rebased it.

Can I reopen the issue just with a comment?

bors added a commit that referenced this pull request Nov 17, 2016
Fix grammar verification

 * Use make check-lexer to verify the grammar.
 * Extend grammar/README
 * Add make clean-grammar rule
 * Add target check-build-lexer-verifier to make tidy, so it will build the verifier with every build and catch future errors

This is the continuation of #34994

r? @steveklabnik @jonathandturner @alexcrichton
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.

7 participants