Skip to content
Draft
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
3 changes: 1 addition & 2 deletions META-INF/RASCAL.MF
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
Project-Name: rascal-website
Source: courses/Recipes, courses/Rascal, src/temp
Require-Libraries: |lib://rascal-tutor|

4 changes: 2 additions & 2 deletions courses/GettingStarted/RascalShell/Commands/Edit/Edit.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ This opens an editor for the given module name. For every context of running Ras
mean different things:

* On the Unix commandline the `${EDITOR}` environment variable will be used to open a file. If that file is present in the local file system, it is opened by running `${EDITOR} /absolute/path/to/module.rsc`, but if the file is hidden behind an opaque ((Values-Location)) scheme, then it is first copied to a temporary file on the local file system, and then opened.
* In Eclipse, the eclipse editor framework is used to open an editor for the file. If it is a so called "resource" in the eclipse file system, and editable file is opened with all the Rascal language support. If the file is from an embedded library (inside a jar) then the contents of the file are shown in a similar editor, but read-only.
* In VScode a similar experience is provided as in Eclipse, but the editor for library files does not know it is read-only.
* In VScode, the editor framework is used to open an editor for the file. If the file is from an embedded library (inside a jar) then the contents of the file are shown in a similar editor, but read-only.

2 changes: 1 addition & 1 deletion courses/GettingStarted/RascalShell/Commands/Quit/Quit.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Quit the RascalShell.
#### Syntax

* `:quit`
* `Ctrl+d` or `Eof`
* `Ctrl+d` or `EOF`

#### Description

Expand Down
5 changes: 5 additions & 0 deletions courses/GettingStarted/RascalShell/Commands/Set/Set.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ The options are:
the results after each RascalShell command.
* `tracing`: while executing Rascal code, print a trace of all function calls.
* `errors`: print more diagnostic stack traces if available (of internal functionality)
* `debugging` : activate break points and step-wise execution with the debugging UI of the IDE (e.g. VScode).

#### Examples

Expand All @@ -40,6 +41,8 @@ import List;
index(["a","b","c"])
```

By the way, see the docs on the ((function:List::index)) function [here]((function:List::index)).

Turn trace off and execute the same function:

```rascal-shell,continue
Expand All @@ -51,6 +54,7 @@ index(["a","b","c"])

* `profiling` provides an accurate and non-invasive profile using a stack sampling method. With high probability the operations that appear to be taking the most time are indeed a bottleneck.
* `tracing` is helpful to see which of the overloaded functions have been called and what their result was.
* `debugging` enables a full featured debugging experience within VScode

#### Pitfalls

Expand All @@ -59,3 +63,4 @@ index(["a","b","c"])
* `profiling` gives insight into the Rascal program's behavior but not necessarily in the underlying cost of interpreting a
Rascal program.
* `errors` is a window into the implementation of Rascal rather than the notion of Rascal programs as they run. It is used for developers of the compiler and interpreter.
* `debugging` only works in VScode
8 changes: 7 additions & 1 deletion courses/GettingStarted/RascalShell/Completion/Completion.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,11 @@ Context-dependent command completion.
#### Description

RascalShell provides context-dependent command completion.
Typing `Tab` autocompletes from the current cursor position and will show all possible completions
Typing the `<TAB>` key autocompletes from the current cursor position and will show all possible completions
(or will directly add the completion when this is unique).

#### Benefits

* Auto-completion works well for incomplete ((Value-Location))s, like `|home:///` + `<TAB>` will list the contents of your home directory.
* Auto-completion knows the currently loaded modules.
* Auto-completion knows variables and function names in the scope of the ((REPL)).
4 changes: 2 additions & 2 deletions courses/GettingStarted/RascalShell/History/History.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@ Typing `Return` will reexecute `c = 3`.
Typing the letter `a` (the search text in this example) followed by `Ctrl+r` will show the text:

```rascal
(reverse-i-search)`a': a = 3;
(reverse-i-search)`a': a = 1;
```
And again, typing `Return` will re-execute `a = 3`.
And again, typing `Return` will re-execute `a = 1;`.
15 changes: 6 additions & 9 deletions courses/GettingStarted/RascalShell/Keyboard/Keyboard.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,23 @@
title: Keyboard Shortcuts
---

#### Synopsis

Keybord shortcuts.

#### Description

When handling console input, RascalShell supports a subset of the shortcuts provided by
[GNU readline](https://en.wikipedia.org/wiki/GNU_Readline)

Some convenient shortcuts are:


| Key combo | Description |
| -------- | ---------- |
| `Ctrl+a` | Move cursor to begin of line. |
| --- | --- |
| `Ctrl+d` | EOF marker, closes the current RascalShell (equivalent to the |
| | command (`quit`). |
| `Ctrl+d` | EOF marker, closes the current RascalShell (equivalent to the command (`quit`). |
| `Ctrl+e` | Move cursor to end of line. |
| `Ctrl+k` | Kill remainder of line after cursor. |
| `Ctrl+l` | Clear screen. |
| `Ctrl+c | Abort current (running) command. |

#### Benefits

* ((RascalShell)) is built on top of [JLine](https://github.com/jline)
* ((RascalShell)) is built on top of [JLine 3](https://github.com/jline/jline3)
* The command shell allows for multiline editing.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Some errors in the format are treated as syntax errors, others generate the `Dat
Remedy: Fix the datetime value notation.

#### Examples

A correct datetime value:
```rascal-shell
$2013-07-15T09:15:23.123+03:00$;
Expand Down
8 changes: 5 additions & 3 deletions courses/Rascal/Statements/Append/Append.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,15 @@ for(int i <- [1..5])
append i*i;
L = for(int i <- [1..5])
append i*i;
```

```rascal-shell
OUTER:for (int i <-[1..5])
for (int j <- [1..5])
append OUTER: <i,j>;
for (int j <- [1..5])
append OUTER: <i,j>;
```

#### Benefits

#### Pitfalls

2 changes: 1 addition & 1 deletion courses/Recipes/BasicProgramming/CodeModels/CodeModels.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ The core language independent model can be found here: [analysis::m3]((Library:a

Extensions for representing facts about specific languages:

* [lang::java::m3]((Library:lang::java::m3)).
* [lang::java::m3]((lang::java::m3)).

#### Examples

Expand Down
7 changes: 7 additions & 0 deletions courses/Recipes/BasicProgramming/Datatypes/Datatypes.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,5 +98,12 @@ $2101-09-05$;

#### Benefits

* Typically for abstract syntax tree ((Datatypes)) we try to use a very **small** set of syntactic types (`EXP` and `STAT`) that more-or-less accurately reflect the abstract syntax of a language, while certainly **over-approximating** the type-correct programs of a language.
* Type-checking is then left for the next language processor, that takes these trees as input. Generally nicer error messages can be produced that way for the user, and the language processors become simpler because there are fewer ((Datatypes)) to remember.
* ((Datatypes)) can be used to represent the abstract syntax tree information from open compilers such as CLANG, JDT and CDT. This way we can reuse parsers and type-checkers from existing compilers.
* Rascal ((Datatypes)) feature an orthogonal "annotation" feature called ["keyword parameters"]((Values-Constructor)). This is where origin locations and types can be stored without changing the structure of the AST.

#### Pitfalls

* Some languages have **huge** abstract syntax tree formats with dozens of types and hundreds of constructors. Sometimes
it is easier to stick with ((module:ParseTree))s and ((ConcreteSyntax)).
17 changes: 16 additions & 1 deletion courses/Recipes/BasicProgramming/Enumerating/Enumerating.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ See [Enumerator]((Rascal:Boolean-Enumerator)) for details.

#### Examples

Without a conditional context, like ((Statements-If)) or ((Statements-For)) or ((Expressions-Comprehensions)), an enumerator simply finds the first element that matches against the left-hand side pattern and returns `true` if it can find it. In other words `<-` acts
like the logical quantifier `exists`:

```rascal
int x <- { 1, 3, 5, 7, 11 }
int x <- [ 1 .. 10 ]
Expand Down Expand Up @@ -72,9 +75,21 @@ for(int x <- {1, 3, 5, 7, 11 })
println("x = <x>");
```

Here you see how ((Statements-If)) is also a conditional context:
```rascal-shell
import IO;
if (int x <- [1,2,3,4], x % 2 == 0)
println("an even <x>");
```

#### Benefits

* Any of the ((Patterns)) can be used on the left-hand side of `<-`
* Variables bound in conditional contexts can be used in the lexical scopes of those contexts and not outside. There exist no "null" references.
* ((Statements-If)) finds the first element that satisfies all conditions, including the ((Patterns)), which is "exists" logic.
* ((Statements-For)) and ((Expressions-Comprehensions)) iterate through all, which is "forall" logic.

#### Pitfalls

The variables that are bound by an enumerator are local to the statement in which the enumerator is used.
* The variables that are bound by an enumerator are local to the statement in which the enumerator is used.

Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ Now assign to variables `S` and `T` the string `"abracadabra"` and let's see wha
```rascal-shell,continue
S = "abracadabra";
T = S;
S = replaceAll("abracadabra", "a", "A");
S = replaceAll(S, "a", "A");
S;
T;
```
Expand Down
1 change: 0 additions & 1 deletion courses/Recipes/Common/CallLifting/CallLifting.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ rel[comp,comp] lift(rel[proc,proc] aCalls, rel[proc,comp] aPartOf)
```rascal-prepare,continue
calls = {<|proc:///main|, |proc:///a|>, <|proc:///main|, |proc:///b|>, <|proc:///a|, |proc:///b|>, <|proc:///a|, |proc:///c|>, <|proc:///a|, |proc:///d|>, <|proc:///b|, |proc:///d|>};
partOf = {<|proc:///main|, |proc:///Appl|>, <|proc:///a|, |proc:///Appl|>, <|proc:///b|, |proc:///DB|>, <|proc:///c|, |proc:///Lib|>, <|proc:///d|, |proc:///Lib|>};

test bool tstLift() =
lift(calls, partOf) == { < |proc:///DB| , |proc:///Lib| > , < |proc:///Appl| , |proc:///Lib| > ,
< |proc:///Appl| , |proc:///DB| > , < |proc:///Appl| , |proc:///Appl| > };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ A typical example of how to use M3 to analyze Java classes.


First we import the basic data types for representing Java. The model is called _M3_, and its definition is split acros a generic
language independent module called ((Library:module:analysis::m3::Core)) and a Java specific part called ((Library:module:lang::java::m3::AST)). Have a look at the documentation
language independent module called ((module:analysis::m3::Core)) and a Java specific part called ((module:lang::java::m3::AST)). Have a look at the documentation
of these modules later. For now we will go through using them in a few examples.

```rascal-prepare
Expand Down
5 changes: 3 additions & 2 deletions courses/Recipes/Metrics/MeasuringJava/MeasuringJava.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ A few steps using the M3 model to compute basic metrics for a Java project in Ec
This is a recipe for computing basic or more advanced metrics from a Java project in Eclipse. We assume:

* You have Rascal installed in an Eclipse instance.
* You have a Rascal project that depends on ((org.rascalmpl.java-air)) in its `pom.xml`
* You have a Java project in your Eclipse workspace that compiles without errors. Let's call it `HelloWorld`.


Expand All @@ -39,7 +40,7 @@ These are a number of recipes for measuring different things about Java:


First we import the basic data types for representing Java. The model is called _M3_, and its definition is split acros a generic
language independent module called ((Library:module:analysis::m3::Core)) and a Java specific part called ((Library:module:lang::java::m3::AST)). Have a look at the documentation
language independent module called ((module:analysis::m3::Core)) and a Java specific part called ((module:lang::java::m3::AST)). Have a look at the documentation
of these modules later. For now we will go through using them in a few examples.

```rascal-prepare
Expand Down Expand Up @@ -71,7 +72,7 @@ You can use this code to extract a classpath if the project is a Maven project:

```rascal-shell,continue
import util::Reflective;
cp = getProjectPathConfig(|tmp:///snakes-and-ladders|).javaCompilerPath;
cp = getProjectPathConfig(|tmp:///snakes-and-ladders|).libs;
```

and then pass it into the M3 extractor (this project does not have dependencies)
Expand Down
2 changes: 1 addition & 1 deletion courses/WhyRascal/UseCases/CodeAsData/CodeAsData.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Code analysis has many motivations. In this example we will see how we can resol
#### Parsing=Turning Code into Data

In this example we use Rascal's JDT library, which wraps Eclipse's Java Development Toolkit compiler for Java and makes its information available as Rascal data types. This intermediate model is called _M3_, and its definition is split acros a generic
language independent module called ((Library:module:analysis::m3::Core)) and a Java specific part called ((Library:module:lang::java::m3::Core)).
language independent module called ((module:analysis::m3::Core)) and a Java specific part called ((module:lang::java::m3::Core)).

```rascal-prepare
import IO;
Expand Down
61 changes: 38 additions & 23 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,24 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

<rascal-maven-plugin.version>0.28.9</rascal-maven-plugin.version>
<rascal.version>0.40.17</rascal.version>
<rascal-tutor.version>0.19.9</rascal-tutor.version>
<clair.version>0.13.1</clair.version>
<rascal-git.version>0.1.15</rascal-git.version>
<flybytes.version>0.2.8</flybytes.version>
<typepal.version>0.14.8</typepal.version>
<salix-core.version>0.2.7</salix-core.version>
<salix-contrib.version>0.2.7</salix-contrib.version>
<rascal-lsp.version>2.21.0-2</rascal-lsp.version>
<drambiguity.version>0.3.5</drambiguity.version>
<php-analysis.version>0.2.4</php-analysis.version>
<python-air.version>0.0.8</python-air.version>
<rascal-maven-plugin.version>0.30.0-RC29-SNAPSHOT</rascal-maven-plugin.version>
<rascal.version>0.41.0-RC53</rascal.version>

<clair.version>0.13.2-RC3-SNAPSHOT</clair.version>
<java-air.version>1.0.0-RC3-SNAPSHOT</java-air.version>
<rascal-git.version>0.1.16-RC3-SNAPSHOT</rascal-git.version>
<flybytes.version>0.2.9-RC3-SNAPSHOT</flybytes.version>
<typepal.version>0.15.2-RC2-SNAPSHOT</typepal.version>

<salix-core.version>0.2.8-RC3-SNAPSHOT</salix-core.version>
<salix-contrib.version>0.2.8-RC2-SNAPSHOT</salix-contrib.version>
<drambiguity.version>0.3.6-RC3-SNAPSHOT</drambiguity.version>

<rascal-lsp.version>2.22.0-RC3-SNAPSHOT</rascal-lsp.version>

<rascal-lucene.version>0.1.0-RC5-SNAPSHOT</rascal-lucene.version>
<php-analysis.version>0.2.5-RC2-SNAPSHOT</php-analysis.version>
<python-air.version>0.0.9-RC3-SNAPSHOT</python-air.version>
</properties>

<build>
Expand Down Expand Up @@ -113,17 +118,16 @@
</artifactItem>
<artifactItem>
<groupId>org.rascalmpl</groupId>
<artifactId>rascal-tutor</artifactId>
<version>${rascal-tutor.version}</version>
<artifactId>clair</artifactId>
<version>${clair.version}</version>
<outputDirectory>${project.basedir}</outputDirectory>
<includes>docs/**/*.*</includes>
<excludes>**/examples/,**/questions/</excludes>
<excludes>docs/index.value</excludes>
</artifactItem>
<artifactItem>
<groupId>org.rascalmpl</groupId>
<artifactId>clair</artifactId>
<version>${clair.version}</version>
<artifactId>java-air</artifactId>
<version>${java-air.version}</version>
<outputDirectory>${project.basedir}</outputDirectory>
<includes>docs/**/*.*</includes>
<excludes>docs/index.value</excludes>
Expand Down Expand Up @@ -160,6 +164,14 @@
<includes>docs/**/*.*</includes>
<excludes>docs/index.value</excludes>
</artifactItem>
<artifactItem>
<groupId>org.rascalmpl</groupId>
<artifactId>rascal-lucene</artifactId>
<version>${rascal-lucene.version}</version>
<outputDirectory>${project.basedir}</outputDirectory>
<includes>docs/**/*.*</includes>
<excludes>docs/index.value</excludes>
</artifactItem>
<artifactItem>
<groupId>org.rascalmpl</groupId>
<artifactId>php-analysis</artifactId>
Expand Down Expand Up @@ -194,8 +206,6 @@
</goals>
<configuration>
<isPackageCourse>false</isPackageCourse>
<enableStandardLibrary>false</enableStandardLibrary>
<errorsAsWarnings>false</errorsAsWarnings>
<bin>${project.basedir}</bin> <!-- because tutor appends /docs to this -->
<srcs>
<!--<src>|lib://rascal/org/rascalmpl/library|</src> -->
Expand Down Expand Up @@ -276,11 +286,11 @@
<groupId>org.rascalmpl</groupId>
<artifactId>clair</artifactId>
<version>${clair.version}</version>
</dependency>
</dependency>
<dependency>
<groupId>org.rascalmpl</groupId>
<artifactId>rascal-tutor</artifactId>
<version>${rascal-tutor.version}</version>
<artifactId>java-air</artifactId>
<version>${java-air.version}</version>
</dependency>
<dependency>
<groupId>org.rascalmpl</groupId>
Expand All @@ -302,6 +312,11 @@
<artifactId>drambiguity</artifactId>
<version>${drambiguity.version}</version>
</dependency>
<dependency>
<groupId>org.rascalmpl</groupId>
<artifactId>rascal-lucene</artifactId>
<version>${rascal-lucene.version}</version>
</dependency>
<dependency>
<groupId>org.rascalmpl</groupId>
<artifactId>php-analysis</artifactId>
Expand Down
Loading
Loading