Closed Jpnock closed 5 months ago
Btw, would you mind removing "[WIP]" from somewhere in the changelog, as I forgot and wanted to avoid creating a new pull request just for that? And also, another pull request from a student happened in parallel to yours and there seems to be overlap - would you mind committing theirs idea (quite small) here, so that we could avoid a merge conflict?
Yet another great set of changes! The repo is getting more and more professional, especially for a coursework 😄 I especially like providing the two ways of going about the grammar (simplified vs full) as it should give the students an interesting design choice.
Thanks for the review :)
Top four suggestions have been implemented and the [WIP]
leftover has been removed. I've also created a CONTRIBUTING.md
based on this which summarises the rules we now follow from the Google style guide.
I've omitted the not implemented
warnings as you suggested since this is already clear in the docs.
As for the long chain in the grammar, I had a think about this and thought it was probably better to keep. I say this for two reasons:
1) It means there are no actual changes between the simplified grammar and the full grammar, other than deletions. I think this will make adding things back one at a time easier than if they have to start figuring out where changes were made to it and reverting our changes when they add more rules. 2) I think it's also easier to introduce them to this chain now where they can just click on each non-terminal and follow it directly up, whereas it's much harder to see how this chain works in the full grammar since it no longer fits in the height of your window.
I did move it to the bottom of the grammar file though so it's seen last when going through the grammar.
I've renamed from ast_statements.(hpp|cpp)
to ast_jump_statement.(hpp|cpp)
. I think it's fine to have all the jump statements in there (e.g. ReturnStatement
, ContinueStatement
) but yeah you're right that if it's every statement in the AST it's going to be way too many.
What does this PR do?
int f() { return 5; }
(@Fiwo735 would you be able to update your image to add INT_CONSTANT to the bottom of it :))int f() { return 5678; }
, since we previously had three of these with just different constant numbers,main()
, such that it is much clearer what's going onlcov
to the Dockerfile, such that Quentin's coverage code will now work inside the container environmenttest.sh
early ifmake
failstest.sh
to be much more human readableprint
method toNode
to allow for the parsed AST to be visualised.gitignore
to ignore coverage and dependency filesint f() { return 5; }
. Note that the full grammar file is retained and docs have been added around how it can be used (using the full grammar does massively increase test time).NodeList
helper class and demonstrates its use for places in the grammar where a list of nodes are requiredCOVERAGE=1 ./test.sh
to allow for args to the script to be used for other purposes in the future (such as paths of specific tests to run)Comments on ASAN
Since ASAN (AddressSanitizer) is turned on, segfaults can easily be diagnosed by reading the log output from stderr (saved into the bin/output directory when you run
./test.sh
). This gives a nice stack trace with the problematic line number.Students will only see this if they navigate to the log file for the test (e.g. the first file in the console output below). In other words, they won't likely see it until they start hunting around the log files when they're having problems getting a test to pass.
To prevent ASAN from changing the compiler exit code, I've set
ASAN_OPTIONS=exitcode=0
to allow the tests intest.sh
to still be attempted even if these logs are produced.