Skip to content

Commit 5bd2d78

Browse files
Completed the descriptions in the example README.md how to execute the examples (#1889)
1 parent 7c4f871 commit 5bd2d78

File tree

4 files changed

+64
-12
lines changed

4 files changed

+64
-12
lines changed

examples/arithmetics/README.md

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,24 @@
44

55
The Arithmetics Example features an interpreter that you can run via cli.
66

7-
* Ensure the complete project was properly built, otherwise run `npm install` from the root of the Langium project.
8-
* Use `node ./bin/cli` from the arithmetics directory to run the cli. Follow the instructions or use `node ./bin/cli eval <full-path-to-calc-file>`.
7+
* Ensure the complete project was properly built, otherwise run `npm install` once in the root of the Langium project. That is enough, since we use npm workspaces to manage all of our npm projects as one monorepo.
8+
* Run `npm run build` (again in the root directly) to actually generate the JavaScript code from the TypeScript sources.
9+
* Use `node ./bin/cli` from the arithmetics directory to run the cli. Follow the instructions or use `node ./bin/cli eval <full-path-to-calc-file>`, e.g.
10+
11+
```bash
12+
cd examples/arithmetics
13+
node ./bin/cli eval example/example.calc
14+
```
15+
16+
produces this result:
17+
18+
```
19+
line 14: 2 * c ===> 16
20+
line 15: b % 2 ===> 1
21+
line 18: Root(D, 3) ===> 4.999999999999999
22+
line 19: Root(64, 3) ===> 3.9999999999999996
23+
line 20: Sqrt(81) ===> 9
24+
```
925

1026
The interpreter calculates each Evaluation in the source file and prints the result.
1127

@@ -17,4 +33,4 @@ You also can use `arithmetics-cli` as a replacement for `node ./bin/cli`, if you
1733
## VSCode Extension
1834

1935
Please use the VSCode run configuration "Run Arithmetics Extension" to launch a new VSCode instance including the extension for this language.
20-
Use the run configuration "Attach" to attach the debugger.
36+
Afterwards, use the run configuration "Attach" to attach the debugger to the running language server.

examples/domainmodel/README.md

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,20 @@
44

55
The Domain Model Example features a generator that you can run via cli.
66

7-
* Ensure the complete project was properly built, otherwise run `npm install` from the root of the Langium project.
8-
* Use `node ./bin/cli` from the domainmodel directory to run the cli. Follow the instructions or use `node ./bin/cli generate <full-path-to-dmodel-file>`.
7+
* Ensure the complete project was properly built, otherwise run `npm install` once in the root of the Langium project. That is enough, since we use npm workspaces to manage all of our npm projects as one monorepo.
8+
* Run `npm run build` (again in the root directly) to actually generate the JavaScript code from the TypeScript sources.
9+
* Use `node ./bin/cli` from the domainmodel directory to run the cli. Follow the instructions or use `node ./bin/cli generate <full-path-to-dmodel-file>`, e.g.
10+
11+
```bash
12+
cd examples/domainmodel
13+
node ./bin/cli generate example/blog.dmodel
14+
```
15+
16+
produces this result:
17+
18+
```
19+
Java classes generated successfully: generated/blog
20+
```
921

1022
The generator produces a Java class for each Entity and setter-getter methods for each Feature.
1123

@@ -16,4 +28,4 @@ You also can use `domainmodel-cli` as a replacement for `node ./bin/cli`, if you
1628
## VSCode Extension
1729

1830
Please use the VSCode run configuration "Run Domainmodel Extension" to launch a new VSCode instance including the extension for this language.
19-
Use the run configuration "Attach" to attach the debugger.
31+
Afterwards, use the run configuration "Attach" to attach the debugger to the running language server.

examples/requirements/README.md

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,20 @@ CLI and tests:
4949

5050
The Example features a generator that you can run via cli to process Requirement Model files. The outcome is a HTML table with a coverage matrix indicating which Test Cases test the Requirements of the file passed to the CLI.
5151

52-
* Ensure the complete project was properly built, otherwise run `npm install` from the root of the Langium project.
53-
* Use `node ./bin/cli` from the requirements directory to run the cli. Follow the instructions or use `node ./bin/cli generate <full-path-to-req-file>`.
52+
* Ensure the complete project was properly built, otherwise run `npm install` once in the root of the Langium project. That is enough, since we use npm workspaces to manage all of our npm projects as one monorepo.
53+
* Run `npm run build` (again in the root directly) to actually generate the JavaScript code from the TypeScript sources.
54+
* Use `node ./bin/cli` from the requirements directory to run the cli. Follow the instructions or use `node ./bin/cli generate <full-path-to-req-file>`, e.g.
55+
56+
```bash
57+
cd examples/requirements
58+
node ./bin/cli generate example/requirements.req
59+
```
60+
61+
produces this result:
62+
63+
```
64+
Requirement coverage generated successfully: generated/requirements.html
65+
```
5466

5567
The generator produces an HTML file.
5668

@@ -62,7 +74,7 @@ You also can use `requirements-and-tests-lang-cli` as a replacement for `node ./
6274
## VSCode Extension
6375

6476
Please use the VSCode run configuration "Run Requirements and Tests Extension" to launch a new VSCode instance including the extension for this language.
65-
Use the run configuration "Attach" to attach the debugger.
77+
Afterwards, use the run configuration "Attach" to attach the debugger to the running language server.
6678

6779
## Validators
6880

examples/statemachine/README.md

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,20 @@
44

55
The State Machine Example features a generator that you can run via cli.
66

7-
* Ensure the complete project was properly built, otherwise run `npm install` from the root of the Langium project.
8-
* Use `node ./bin/cli` from the statemachine directory to run the cli. Follow the instructions or use `node ./bin/cli generate <full-path-to-statemachine-file>`.
7+
* Ensure the complete project was properly built, otherwise run `npm install` once in the root of the Langium project. That is enough, since we use npm workspaces to manage all of our npm projects as one monorepo.
8+
* Run `npm run build` (again in the root directly) to actually generate the JavaScript code from the TypeScript sources.
9+
* Use `node ./bin/cli` from the statemachine directory to run the cli. Follow the instructions or use `node ./bin/cli generate <full-path-to-statemachine-file>`, e.g.
10+
11+
```bash
12+
cd examples/statemachine
13+
node ./bin/cli generate example/trafficlight.statemachine
14+
```
15+
16+
produces this result:
17+
18+
```
19+
C++ code generated successfully: generated/trafficlight.cpp
20+
```
921

1022
The generator produces a C++ cli to walk over the statemachine's states.
1123

@@ -20,4 +32,4 @@ You also can use `statemachine-cli` as a replacement for `node ./bin/cli`, if yo
2032
## VSCode Extension
2133

2234
Please use the VSCode run configuration "Run Statemachine Extension" to launch a new VSCode instance including the extension for this language.
23-
Use the run configuration "Attach" to attach the debugger.
35+
Afterwards, use the run configuration "Attach" to attach the debugger to the running language server.

0 commit comments

Comments
 (0)