Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ test bool incompatibleVersionsOfBinaryLibrary(){

// Important: we do not recompile TP (and thus it will contain the outdated version of IO)

// Update Checks' modifcation time to make sure it will rechecked
// Update Checks' modification time to make sure it will rechecked
touch(getRascalModuleLocation("Check", core.pcfg));
// Recompile Check and discover the error
return checkExpectErrors("Check", ["Review of dependencies, reconfiguration or recompilation needed: binary module `TP` depends (indirectly) on incompatible module(s)"], core.pcfg, remove = [rascal, typepal, core]);
Expand Down
2 changes: 1 addition & 1 deletion src/org/rascalmpl/library/IO.rsc
Original file line number Diff line number Diff line change
Expand Up @@ -682,7 +682,7 @@ public java void remove(loc file, bool recursive=true) throws IO;
@javaClass{org.rascalmpl.library.Prelude}
@synopsis{Rename files or directories}
@benefits{
* will rename between schemes and within schemes, seemlessly.
* will rename between schemes and within schemes, seamlessly.
* within schemes renaming is implemented as close to the operating system rename functionality as possible. This can be very fast.
}
@pitfalls{
Expand Down
4 changes: 2 additions & 2 deletions src/org/rascalmpl/library/List.rsc
Original file line number Diff line number Diff line change
Expand Up @@ -362,12 +362,12 @@ Optional, a comparison function `lessOrEqual` may be given for a user-defined or
```rascal-shell
import List;
merge([1, 3, 5], [2, 7, 9, 15]);
merge(["ape", "elephant", "owl", "snale", "zebra"], ["apple", "berry", "orange", "pineapple"]);
merge(["ape", "elephant", "owl", "snail", "zebra"], ["apple", "berry", "orange", "pineapple"]);
```
Merge two lists of strings and use their length as ordering:
```rascal-shell,continue
import String;
merge(["ape", "owl", "snale", "zebra", "elephant"], ["apple", "berry", "orange", "pineapple"], bool(str x, str y){ return size(x) <= size(y); });
merge(["ape", "owl", "snail", "zebra", "elephant"], ["apple", "berry", "orange", "pineapple"], bool(str x, str y){ return size(x) <= size(y); });
```
}
list[&T] merge(list[&T] left, list[&T] right){
Expand Down
12 changes: 6 additions & 6 deletions src/org/rascalmpl/library/ListRelation.rsc
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ public lrel[&T0, &T1, &T2, &T3, &T4] complement(lrel[&T0, &T1, &T2, &T3, &T4] R)
@description{
The domain can be seen as all possible inputs of the relation image operation. The
result contains elements (or tuples) in the order of appearance of the original relation,
but all occurences after the first occurrence of an element have been removed.
but all occurrences after the first occurrence of an element have been removed.
}
@examples{
```rascal-shell
Expand Down Expand Up @@ -171,7 +171,7 @@ public lrel[&T0,&T1,&T2,&T3] domainR (lrel[&T0,&T1,&T2,&T3] R, set[&T0] S)
public lrel[&T0,&T1,&T2,&T3,&T4] domainR (lrel[&T0,&T1,&T2,&T3,&T4] R, set[&T0] S)
= [ <V0, V1, V2, V3, V4> | <&T0 V0, &T1 V1, &T2 V2, &T3 V3, &T4 V4> <- R, V0 in S ];

// If the restiction is specified as a list, we take the order of tuples from there
// If the restriction is specified as a list, we take the order of tuples from there
public lrel[&T0,&T1] domainR (lrel[&T0,&T1] R, list[&T0] L)
= [ <V0, V1> | &T0 V0 <- L, <V0, &T1 V1> <- R];

Expand Down Expand Up @@ -214,7 +214,7 @@ public lrel[&T0, &T1, &T2, &T3, &T4] domainX (lrel[&T0, &T1, &T2, &T3, &T4] R, s
@examples{
```rascal-shell
import ListRelation;
legs = [<"bird", 2>, <"dog", 4>, <"human", 2>, <"spider", 8>, <"millepede", 1000>, <"crab", 8>, <"cat", 4>];
legs = [<"bird", 2>, <"dog", 4>, <"human", 2>, <"spider", 8>, <"millipede", 1000>, <"crab", 8>, <"cat", 4>];
groupDomainByRange(legs);
```
}
Expand Down Expand Up @@ -266,7 +266,7 @@ public lrel[&T4,&T3,&T2,&T1,&T0] invert (lrel[&T0,&T1,&T2,&T3,&T4] R) = R<4,3,2,
@description{
The range can be seen as all the elements of in all possible images of the relation. The
result contains elements (or tuples) in the order of appearance of the original relation,
but all occurences after the first occurrence of an element have been removed.
but all occurrences after the first occurrence of an element have been removed.
}
@examples{
```rascal-shell
Expand Down Expand Up @@ -294,7 +294,7 @@ rangeR([<1,10>, <2,20>, <3,30>], {30, 10});
public lrel[&T0,&T1] rangeR (lrel[&T0,&T1] R, set[&T1] S)
= [ <V0, V1> | <&T0 V0, &T1 V1> <- R, V1 in S ];

// If the restiction is specified as a list, we take the order of tuples from there
// If the restriction is specified as a list, we take the order of tuples from there
public lrel[&T0,&T1] rangeR (lrel[&T0,&T1] R, list[&T1] L)
= [ <V0, V1> | &T1 V1 <- L, <&T0 V0, V1> <- R ];

Expand All @@ -316,7 +316,7 @@ public lrel[&T0,&T1] rangeX (lrel[&T0,&T1] R, list[&T1] S)
= [ <V0, V1> | <&T0 V0, &T1 V1> <- R, V1 notin S ];


@synopsis{Listes a binary list relation as a map}
@synopsis{Lists a binary list relation as a map}
@description{
Converts a binary list relation to a map of the domain to a set of the range.
}
Expand Down
4 changes: 2 additions & 2 deletions src/org/rascalmpl/library/Location.rsc
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ loc relativize(list[loc] haystack, loc needle) throws PathNotFound {
throw PathNotFound(needle);
}

@synsopis{Concatenate a relative path to a given surrounding path}
@synopsis{Concatenate a relative path to a given surrounding path}
@description{
* `relative` must be of scheme `relative:///` or `SchemeNotSupported` will be thrown
* ((resolve)) is the opposite of ((relativize))
Expand Down Expand Up @@ -94,7 +94,7 @@ java bool isSameFile(loc l, loc r);
When the two locations refer to different files, their paths are compared as string.
When they refer to the same file, their offsets are compared when present.
}
@pittfalls{
@pitfalls{
This ordering regards the location value itself as opposed to the text it refers to.
}
bool isLexicallyLess(loc l, loc r)
Expand Down
14 changes: 7 additions & 7 deletions src/org/rascalmpl/library/ParseTree.rsc
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ import Set;

@synopsis{The Tree data type as produced by the parser.}
@description{
A `Tree` defines the trees normally found after parsing; additional constructors exist for execptional cases:
A `Tree` defines the trees normally found after parsing; additional constructors exist for exceptional cases:

<1> Parse tree constructor when parse succeeded.
<2> Cyclic parsetree.
Expand Down Expand Up @@ -396,7 +396,7 @@ conversion methods to make sure selection and highlighting ranges (for example)
character metaphor breaks. It depends on how the editor internally handles graphemes and on the way it is connected to Rascal
what the effect for the user is.
* @\loc annotations make ((Tree)) instances _unique_ ,where otherwise they could be semantically and syntactically equivalent.
Therefor if you want to test for ((Tree)) (in)equality, always use `t1 := t2` and `t1 !:= t2`. Pattern matching already automatically
Therefore if you want to test for ((Tree)) (in)equality, always use `t1 := t2` and `t1 !:= t2`. Pattern matching already automatically
ignores @\loc annotations and whitespace and comments.
* Annotated trees are strictly too big for optimal memory usage. Often `@\loc` is the first and only annotation, so it introduces a map for keyword parameters
for every node. Also more nodes are different, impeding in optimal reference sharing. If you require long time storage of many
Expand Down Expand Up @@ -524,7 +524,7 @@ java &T (value input, loc origin) parser(type[&T] grammar, bool allowAmbiguity=f
@javaClass{org.rascalmpl.library.Prelude}
@synopsis{Generates a parser function that can be used to find the left-most deepest ambiguous sub-sentence.}
@benefits{
* Instead of trying to build a polynomially sized parse forest, this function only builds the smallest part of
* Instead of trying to build a polynomial-sized parse forest, this function only builds the smallest part of
the tree that exhibits ambiguity. This can be done very quickly, while the whole forest could take minutes to hours to construct.
* Use this function for ambiguity diagnostics and regression testing for ambiguity.
}
Expand All @@ -545,7 +545,7 @@ java &U (type[&U] nonterminal, value input, loc origin) parsers(type[&T] grammar
@javaClass{org.rascalmpl.library.Prelude}
@synopsis{Generates a parser function that can be used to find the left-most deepest ambiguous sub-sentence.}
@benefits{
* Instead of trying to build a polynomially sized parse forest, this function only builds the smallest part of
* Instead of trying to build a polynomial-sized parse forest, this function only builds the smallest part of
the tree that exhibits ambiguity. This can be done very quickly, while the whole forest could take minutes to hours to construct.
* Use this function for ambiguity diagnostics and regression testing for ambiguity.
}
Expand Down Expand Up @@ -585,7 +585,7 @@ for the same grammar, if (and only if) it was stored for the same grammar value.
}
@benefits{
* storing parsers is to cache the work of reifing a grammar, and generating a parser from that grammar.
* stored parsers are nice for deployment scenerios where the language is fixed and efficiency is appreciated.
* stored parsers are nice for deployment scenarios where the language is fixed and efficiency is appreciated.
}
@pitfalls{
* caching parsers with `storeParsers` is your responsibility; the cache is not cleaned automatically when the grammar changes.
Expand Down Expand Up @@ -625,7 +625,7 @@ p(type(sort("E"), ()), "e+e", |src:///|);
```
}
@benefits{
* loaded parsers can be used immediately without the need of loadig and executing a parser generator.
* loaded parsers can be used immediately without the need of loading and executing a parser generator.
}
@pitfalls{
* reifiying types (use of `#`) will trigger the loading of a parser generator anyway. You have to use
Expand Down Expand Up @@ -874,7 +874,7 @@ yield of a tree should always produce the exact same locations as ((reposition))
@benefits{
* Unlike reparsing, ((reposition)) will maintain all other keyword parameters of ((Tree)) nodes, like resolved qualified names and type attributes.
* Can be used to erase superfluous annotations for memory efficiency, while keeping the essential ones.
* The default mark options simulatete the behavior of ((parser)) functions.
* The default mark options simulate the behavior of ((parser)) functions.
}
&T <: Tree reposition(
&T <: Tree tree,
Expand Down
2 changes: 1 addition & 1 deletion src/org/rascalmpl/library/Relation.rsc
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ public rel[&T0,&T1,&T2,&T3,&T4] domainX (rel[&T0,&T1,&T2,&T3,&T4] R, set[&T0] S)
@examples{
```rascal-shell
import Relation;
legs = {<"bird", 2>, <"dog", 4>, <"human", 2>, <"spider", 8>, <"millepede", 1000>, <"crab", 8>, <"cat", 4>};
legs = {<"bird", 2>, <"dog", 4>, <"human", 2>, <"spider", 8>, <"millipede", 1000>, <"crab", 8>, <"cat", 4>};
groupDomainByRange(legs);
```
}
Expand Down
12 changes: 6 additions & 6 deletions src/org/rascalmpl/library/Set.rsc
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import Set;
```
Create a map from animals to number of legs.
```rascal-shell,continue
legs = ("bird": 2, "dog": 4, "human": 2, "snake": 0, "spider": 8, "millepede": 1000, "crab": 8, "cat": 4);
legs = ("bird": 2, "dog": 4, "human": 2, "snake": 0, "spider": 8, "millipede": 1000, "crab": 8, "cat": 4);
```
Define function `nLegs` that returns the number of legs for each animal (or `0` when the animal is unknown):
```rascal-shell,continue
Expand All @@ -42,7 +42,7 @@ int nLegs(str animal){
```
Now classify a set of animals:
```rascal-shell,continue
classify({"bird", "dog", "human", "spider", "millepede", "zebra", "crab", "cat"}, nLegs);
classify({"bird", "dog", "human", "spider", "millipede", "zebra", "crab", "cat"}, nLegs);
```
}
public map[&K,set[&V]] classify(set[&V] input, &K (&V) getClass) = toMap({<getClass(e),e> | e <- input});
Expand All @@ -58,7 +58,7 @@ import Set;
```
Create a map from animals to number of legs.
```rascal-shell,continue
legs = ("bird": 2, "dog": 4, "human": 2, "snake": 0, "spider": 8, "millepede": 1000, "crab": 8, "cat": 4);
legs = ("bird": 2, "dog": 4, "human": 2, "snake": 0, "spider": 8, "millipede": 1000, "crab": 8, "cat": 4);
```
Define function `nLegs` that returns the number of legs fro each animal (or `0` when the animal is unknown):
```rascal-shell,continue
Expand All @@ -69,7 +69,7 @@ bool similar(str a, str b) = nLegs(a) == nLegs(b);
```
Now group a set of animals:
```rascal-shell,continue
group({"bird", "dog", "human", "spider", "millepede", "zebra", "crab", "cat"}, similar);
group({"bird", "dog", "human", "spider", "millipede", "zebra", "crab", "cat"}, similar);
```
WARNING: check compiler.
}
Expand Down Expand Up @@ -251,7 +251,7 @@ public java int size(set[&T] st);

public (&T <:num) sum(set[(&T <:num)] _:{}) {
throw ArithmeticException(
"For the emtpy set it is not possible to decide the correct precision to return.\n
"For the empty set it is not possible to decide the correct precision to return.\n
'If you want to call sum on empty set, use sum({0.000}+st) or sum({0r} +st) or sum({0}+st)
'to make the set non-empty and indicate the required precision for the sum of the empty set
");
Expand Down Expand Up @@ -493,7 +493,7 @@ This function is fast if `k` is relatively small, say 10 out of a 1000 elements.
It operates in O(n*k) time where n is the size of the set.

If `k` is a larger value, say `k > 10`, then it's perhaps better to just sort the entire set
using the asympotically faster (n*log^2(n)) sort function and take the first `k` elements of the resulting list.
using the asymptotically faster (n*log^2(n)) sort function and take the first `k` elements of the resulting list.

If `k` is a negative number, `top` will return the largest `abs(k)` elements of the set instead of the smallest.
}
Expand Down
6 changes: 3 additions & 3 deletions src/org/rascalmpl/library/String.rsc
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,7 @@ public java str toBase64(str src, str charset=DEFAULT_CHARSET, bool includePaddi

@synopsis{Decode a base-64 encoded string.}
@description {
Convert a base-64 encoded string to bytes and then convert these bytes to a string using the specified cahracter set.
Convert a base-64 encoded string to bytes and then convert these bytes to a string using the specified character set.
The base-64 encoding used is defined by RFC 4648: https://www.ietf.org/rfc/rfc4648.txt.
}
@javaClass{org.rascalmpl.library.Prelude}
Expand All @@ -600,7 +600,7 @@ public java str toBase32(str src, str charset=DEFAULT_CHARSET, bool includePaddi

@synopsis{Decode a base-32 encoded string.}
@description {
Convert a base-32 encoded string to bytes and then convert these bytes to a string using the specified cahracter set.
Convert a base-32 encoded string to bytes and then convert these bytes to a string using the specified character set.
The base-32 encoding used is defined by RFC 4648: https://www.ietf.org/rfc/rfc4648.txt.
}
@javaClass{org.rascalmpl.library.Prelude}
Expand Down Expand Up @@ -643,7 +643,7 @@ toLocation("http://grammarware.net");
toLocation("document.xml");
```
}
@deprecated{Use ((lang::paths::Windows::parseWindowsPath)) for example; toLocation does not handle all intricasies of path notation.}
@deprecated{Use ((lang::paths::Windows::parseWindowsPath)) for example; toLocation does not handle all intricacies of path notation.}
public loc toLocation(str s) = (/<car:.*>\:\/\/<cdr:.*>/ := s) ? |<car>://<cdr>| : |cwd:///<s>|;


Expand Down
8 changes: 4 additions & 4 deletions src/org/rascalmpl/library/Type.rsc
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ In other words, the `#` operator will always produce a value of `type[&T]`, wher

The ((subtype)) relation of Rascal has all the mathematical properties of a _finite lattice_; where ((lub)) implements the _join_ and ((glb)) implements the _meet_ operation.
This is a core design principle of Rascal with the following benefits:
* Type inference has a guaranteed least or greatest solution, always. This means that constraints are always solvable in an unambigous manner.
* Type inference has a guaranteed least or greatest solution, always. This means that constraints are always solvable in an unambiguous manner.
* A _principal type_ can always be computed, which is a most precise and unique solution of a type inference problem. Without the lattice, solution candidates could become incomparable and thus ambiguous. Without
this principal type property, type inference is predictable for programmers.
* Solving type inference constraints can be implemented efficiently. The algorithm, based on ((lub)) and ((glb)), makes progress _deterministically_ and does not require backtracking
Expand Down Expand Up @@ -113,7 +113,7 @@ Symbol \lrel(list[Symbol] symbols)
= \list(\tuple(symbols));


@synopsis{Overloaded/union types are always reduced to the least upperbound of their constituents.}
@synopsis{Overloaded/union types are always reduced to the least upper bound of their constituents.}
@description{
This semantics of overloading in the type system is essential to make sure it remains a _lattice_.
}
Expand Down Expand Up @@ -249,7 +249,7 @@ bool equivalent(type[value] s, type[value] t) = equivalent(s.symbol, t.symbol);
The difference between `eq` and `==` is that no implicit coercions are done between values of incomparable types
at the top-level.

The `==` operator, for convience, equates `1.0` with `1` but not `[1] with [1.0]`, which can be annoying
The `==` operator, for convenience, equates `1.0` with `1` but not `[1] with [1.0]`, which can be annoying
when writing consistent specifications. The new number system that is coming up will not have these issues.
}
@examples{
Expand All @@ -262,7 +262,7 @@ eq(1,1.0)
@javaClass{org.rascalmpl.library.Type}
java bool eq(value x, value y);

@synopsis{The least-upperbound (lub) of two types is the common ancestor in the type lattice that is lowest.}
@synopsis{The least upper bound (lub) of two types is the common ancestor in the type lattice that is lowest.}
@description{
This function implements the lub operation in Rascal's type system, via unreifying the Symbol values
and calling into the underlying run-time Type implementation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ This algorithm is the final component of a declarative high fidelity source code

We have the following assumptions:
1. One original text file exists.
2. One ((ParseTree)) of the original file to be formatted, containing all orginal layout and source code comments and case-insensitive literals in the exact order of the original text file. In other words,
2. One ((ParseTree)) of the original file to be formatted, containing all original layout and source code comments and case-insensitive literals in the exact order of the original text file. In other words,
nothing may have happened to the parse tree after parsing.
3. One ((ParseTree)) of the _same_ file, but formatted (using a formatting algorithm like ((Tree2Box)) `|` ((Box2Text)), or string templates, and then re-parsing). This is typically obtained by
translating the tree to a `str` using some formatting tools, and then reparsing the file.
Expand Down
Loading
Loading