-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0605602
commit 1950061
Showing
3 changed files
with
191 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,6 @@ | ||
bin | ||
.DS_Store | ||
.settings | ||
pom.xml.releaseBackup | ||
release.properties | ||
target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
|
||
## version 0.3.0 | ||
|
||
* Added Regression module for running the examples in a model against a new grammar | ||
as a test during continuous integration. | ||
|
||
## version 0.2.1 | ||
|
||
* fixed body height for screenshots | ||
* fixed the effort slider | ||
|
||
## version 0.2.0 | ||
|
||
* changed color of popups for legibility | ||
|
||
## version 0.1.8 | ||
|
||
* enabled screenshots on the CI server | ||
|
||
## release 0.1.7 | ||
|
||
* automatic screenshots using salix popups and tutor screenshot feature | ||
* working towards the first screenshot with auto popups | ||
* better salix code | ||
* moving DrAmbiguity into a proper namespace | ||
* documenting the user interface with the new salix withPopups feature | ||
* detailed improvements of UI style | ||
* tabs work better now. also do not generate view for invisible tabs | ||
* made tabs part of the model and added test for too deep amb nesting | ||
* moved chance for termination to 60% to deal with rules with many recursive positions | ||
* better docs | ||
|
||
## release 0.1.6 | ||
|
||
* minor documentation fixes | ||
|
||
## release 0.1.5 | ||
|
||
* minor fixes | ||
|
||
## release 0.1.4 | ||
|
||
* wrote all the documentation | ||
|
||
## release 0.1.3 | ||
|
||
* added FUNDING file | ||
* completed citation information | ||
* minor fixes | ||
|
||
## release 0.1.2 | ||
|
||
* fixed minor issues | ||
|
||
## release 0.1.1 | ||
|
||
* latest versions of salix-core and rascal | ||
|
||
## release 0.1.0 | ||
|
||
* fixed all possible static warnings and errors and set errorAsWarnings to true because of false positives by the type-checker | ||
* refactoring | ||
* removed dead code | ||
* updates after salix fixes in textarea, and some unrelated improvements | ||
* optimizations and fixes | ||
|
||
## version 0.0.1 | ||
|
||
DrAmbiguity is back alive again! Ported and reimplemented from the Rascal standard library. | ||
|
||
* added github action | ||
* working on simplifier | ||
* improved visuals by rendering top-level alternatives side-by-side. | ||
* fixed focus functionality | ||
* factored makeApp for maintainability | ||
* added license and code of conduct | ||
* added regression tests for parse errors as well | ||
* added rudimentary grammar version management support | ||
* added project save/load feature | ||
* fixed issues with text areas | ||
* fixed reparse of input | ||
* removed false positives, and some other fixes | ||
* improving robustness for weird things in grammars and inputs | ||
* big steps including rudimentary grammar editor | ||
* revamped the diagnostics tool | ||
* ambiguous sentence generator is now workable | ||
* experimenting and improving the UI | ||
* make sure graphs are visible after adding new nodes or removing nodes, by scaling and positions relative to the actual size of the bounding box. | ||
* simplified tree generation | ||
* fixed termination issues for expression languages with many more recursive alternatives than non-recursive ones | ||
* better termination behavior due to parent recursion filtering | ||
* added random sentence generation and random ambiguity detection and minimizaton algorithm separated | ||
* added CITATION file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
@synopsis{Utility to run stored tests against a new grammar and report new issues} | ||
module analysis::grammars::dramb::Regression | ||
|
||
import analysis::grammars::dramb::Util; | ||
import analysis::grammars::dramb::Model; | ||
import ValueIO; | ||
import IO; | ||
import Exception; | ||
import util::Maybe; | ||
import ParseTree; | ||
import List; | ||
|
||
@synopsis{Models the bad things that can happen when we parse old strings with a new grammar} | ||
data ParsingRegression | ||
= error(str sentence, Symbol nonTerminal, loc src) | ||
| ambiguity(str sentence, Symbol nonTerminal, Tree cluster) | ||
| crash(str sentence, Symbol nonTerminal, value exception) | ||
; | ||
|
||
@synopsis{Run the stored regression test sentences against a new grammar} | ||
@description{ | ||
This function runs the stashed sentences in the model against a new version of the grammar. | ||
It returns `true` if no new errors are detected, and `false` if there are. | ||
If this function returns `false` then it's time to run ((drAmbiguity)) interactively to: | ||
* either fix the examples to reflect to the new grammar (for example the syntax has changed) | ||
* or fix the grammar to make sure no new ambiguities or errors are introduced anymore. | ||
} | ||
@benefits{ | ||
* Use this as a `test` function in your own syntax project, and run it during continuous integration testing. | ||
:::info | ||
It's best to use ((IO::findResources)) to locate the binary file that stores your drAmbiguity model. | ||
::: | ||
} | ||
@pitfalls{ | ||
* This function does not provide the diagnostics features of ((drAmbiguity)). It's better to use the interactive tool for that. | ||
* Storing binary files in git repositories is not recommended, but it is still the best way to keep a drAmbiguity model around. | ||
} | ||
bool testForParsingRegressions(type[&T <: Tree] newGrammar, loc oldModelLocation) { | ||
messages = runRegressionTests(newGrammar, oldModelLocation); | ||
|
||
if (messages == []) { | ||
return true; | ||
} | ||
|
||
parseErrors = [m | m <- messages, m is error]; | ||
ambiguities = [m | m <- messages, m is ambiguity]; | ||
crashes = [m | m <- messages, m is crash]; | ||
|
||
println("The regression test failed with <if (parseErrors != []) {> | ||
' - <size(parseErrors)> new parse errors<}><if (ambiguities != []) {> | ||
' - <size(ambiguities)> new ambiguous sentences<}><if (crashes != []) {> | ||
' - <size(crashes)> new unexpected crashes<}> | ||
'"); | ||
|
||
return false; | ||
} | ||
|
||
@synopsis{Reads the old model from a binary file and then continues to run the regression tests.} | ||
list[ParsingRegression] runRegressionTests(type[&T <: Tree] newGrammar, loc oldModelLocation) | ||
= runRegressionTests(newGrammar, readBinaryValueFile(#Model, oldModelLocation)); | ||
|
||
@synopsis{This is the workhorse that runs the regression tests; it simulates exactly what the interactive tool also does when a grammar is updated.} | ||
@description{ | ||
By reparsing all the examples in the stored model we find out if there are new parse errors, new ambiguities, or new crashes. | ||
We collect the errors and return them as a list for later inspection. However, it is recommended to use the interactive | ||
((drAmbiguity)) tool for diagnostics rather than studying this list. | ||
} | ||
list[ParsingRegression] runRegressionTests(type[&T <: Tree] newGrammar, Model m) { | ||
return for (<str ex, Symbol s, Maybe[Tree] _t, str _st> <- m.examples) { | ||
try { | ||
print("parsing <ex> with <type(s, ())>..."); | ||
tt = reparse(newGrammar, s, ex); | ||
|
||
if (/a:amb(_) := tt) { | ||
println(" ambiguous!"); | ||
append ambiguity("<a>", symbol(a), a); | ||
} | ||
else { | ||
println(" ok!"); | ||
} | ||
} | ||
catch ParseError(_e) : { | ||
println(" parse error!"); | ||
append error(ex, s, _e); | ||
} | ||
catch value v: { | ||
println(" unexpected crash!"); | ||
append crash(ex, s, v); | ||
} | ||
}; | ||
} |