Skip to content

Commit 6f800df

Browse files
committed
Review and update Truffle READMEs and Language Tutorial doc
1 parent c628812 commit 6f800df

File tree

4 files changed

+42
-64
lines changed

4 files changed

+42
-64
lines changed

truffle/README.md

+21-34
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,57 @@
1-
# The Truffle Language Implementation Framework
1+
# Truffle Language Implementation Framework
22

33
## Introduction
44

5-
Truffle is an Open Source library for building programming language implementations as interpreters for self-modifying Abstract Syntax Trees.
6-
Together with the Open Source [Graal Compiler](../compiler), Truffle represents a significant step
5+
The Truffle language implementation framework (Truffle) is an open-source library for building programming language implementations as interpreters for self-modifying Abstract Syntax Trees.
6+
Together with the open-source [Graal compiler](https://github.com/oracle/graal/tree/master/compiler), Truffle represents a significant step
77
forward in programming language implementation technology in the current era of dynamic languages.
88

9-
A growing body of shared implementation code and services
10-
reduces language implementation effort significantly, but leads to competitive runtime
11-
performance that matches or exceeds the competition. The value of the platform is further
12-
increased by support for low-overhead language interoperability, as well as a general instrumentation
13-
framework that supports multi-language debugging and other external developer tools.
9+
A growing body of shared implementation code and services reduces language implementation effort significantly, but leads to runtime performance that matches or exceeds the competition.
10+
The value of the platform is further increased by support for low-overhead language interoperability, as well as a general instrumentation framework that supports multilanguage debugging and other external developer tools.
1411

15-
Truffle is developed and maintained by Oracle Labs and the Institute for System
16-
Software of the Johannes Kepler University Linz.
12+
Truffle is developed and maintained by Oracle and the Institute for System Software of the Johannes Kepler University Linz.
1713

1814
## Using Truffle
1915

2016
If you are looking for documentation on how to use Truffle, please consult the documentation [here](docs/README.md) or [on the website](https://www.graalvm.org/graalvm-as-a-platform/language-implementation-framework/).
2117

2218
## Hacking Truffle
2319

24-
Truffle and Graal use the [MX build tool](https://github.com/graalvm/mx/),
25-
which needs to be installed before using this repository. To do so execute
26-
in a clean directory:
27-
20+
Truffle and the Graal compiler use the [MX build tool](https://github.com/graalvm/mx/), which needs to be installed before using this repository.
21+
To install it, run these commands in a clean directory:
2822
```bash
2923
$ git clone https://github.com/graalvm/mx.git/
3024
$ mx/mx
3125
```
3226

33-
the mx/*mx* command is a wrapper around Python script that serves as our build tool.
34-
Make sure you put it onto your `PATH` and then you can work with Truffle
35-
sources from a command line:
36-
27+
The `mx` command is a wrapper around the Python script that serves as a build tool.
28+
Make sure you put it onto your `PATH` and then you can work with Truffle sources from a command line:
3729
```bash
3830
$ mx clean
3931
$ mx build
4032
$ mx unittest
4133
```
4234

4335
The created `./mxbuild/dists` directory contains all necessary jars and source bundles.
44-
45-
- `truffle-api.jar` contains the framework
46-
- `truffle-dsl-processor.jar` contains the TruffleDSL annotation processor
36+
- `truffle-api.jar` contains the framework
37+
- `truffle-dsl-processor.jar` contains the TruffleDSL annotation processor
4738

4839
You can open Truffle sources in your favorite Java IDE by invoking:
49-
5040
```bash
5141
$ mx ideinit
5242
```
5343

54-
The necessary IDE metadata will then be generated into *truffle* subdirectory
55-
and its folders.
56-
57-
The `mx` tool supports Maven integration. To register prebuilt binaries into local Maven
58-
repository you can invoke:
44+
The necessary IDE metadata will be generated into _truffle/_ subdirectory
45+
and its directories.
5946

47+
The `mx` tool supports Maven integration.
48+
To register prebuilt binaries into your local Maven repository, run:
6049
```bash
6150
$ mx build
6251
$ mx maven-install
6352
```
6453

65-
Then it is possible to include the artifacts as dependencies to a `pom.xml`:
66-
54+
Then it is possible to add Truffle artifacts as dependencies to the Maven configuration file, _pom.xml_:
6755
```xml
6856
<dependency>
6957
<groupId>org.graalvm.truffle</groupId>
@@ -81,17 +69,16 @@ Then it is possible to include the artifacts as dependencies to a `pom.xml`:
8169
## Contributing
8270

8371
To contribute a change, verify it using:
84-
8572
```bash
8673
$ mx gate
8774
```
88-
Then start a [pull request](https://help.github.com/articles/using-pull-requests/).
89-
Detailed info can be found in the [contributing document](CONTRIBUTING.md).
75+
Then create a [pull request](https://help.github.com/articles/using-pull-requests/).
76+
Detailed information can be found in the [contributing document](CONTRIBUTING.md).
9077

9178
## Community
9279

93-
To reach out to the Truffle community (as well as the wider GraalVM community) consider the information available at https://www.graalvm.org/community/.
94-
There is a dedicated Truffle channel (`#truffle`) on the GraalVM community slack (https://www.graalvm.org/slack-invitation/).
80+
To reach out to the Truffle community (as well as the wider GraalVM community) consider the information available at the [GraalVM website](https://www.graalvm.org/community/).
81+
There is a dedicated Truffle channel (`#truffle`) on the [GraalVM community slack](https://www.graalvm.org/slack-invitation/).
9582

9683
## License
9784

truffle/docs/LanguageTutorial.md

+4-8
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,13 @@ permalink: /graalvm-as-a-platform/language-implementation-framework/LanguageTuto
77
# Implementing a New Language with Truffle
88

99
For an in-depth presentation on how to implement your language with Truffle,
10-
watch this [three-hour walkthrough](https://youtu.be/FJY96_6Y3a4) presented at the
10+
watch this [video walkthrough](#) presented at the
1111
Conference on Programming Language Design and Implementation [PLDI 2016](http://conf.researchr.org/home/pldi-2016).
1212

13-
<a href="http://www.youtube.com/watch?feature=player_embedded&v=FJY96_6Y3a4" target="_blank">
14-
<img src="http://img.youtube.com/vi/FJY96_6Y3a4/0.jpg" alt="Youtube Video Player" width="854" height="480" border="10" />
15-
</a>
13+
[Download slides](https://lafo.ssw.uni-linz.ac.at/pub/papers/2016_PLDI_Truffle.pdf).
1614

17-
[Download Slides](https://lafo.ssw.uni-linz.ac.at/pub/papers/2016_PLDI_Truffle.pdf)
18-
19-
Next Steps:
15+
Next steps:
2016
* Start to subclass [TruffleLanguage](http://www.graalvm.org/truffle/javadoc/com/oracle/truffle/api/TruffleLanguage.html) for your own language implementation.
21-
* Fork [SimpleLanguage](https://github.com/graalvm/simplelanguage), a toy language that demonstrates how to use many Truffle features.
17+
* Fork [SimpleLanguage](https://github.com/graalvm/simplelanguage), a toy language that demonstrates how to use Truffle features.
2218
* Embed Truffle languages in Java host applications using the [Polyglot API](../../docs/reference-manual/embedding/embed-languages.md).
2319
* Read [GraalVM/Truffle publications](https://github.com/oracle/graal/blob/master/docs/Publications.md).

truffle/docs/Languages.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ The following language implementations exist already (in alphabetical order):
1111
* [Enso](https://github.com/enso-org/enso), an open source, visual language for data science that lets you design, prototype and develop any application by connecting visual elements together.
1212
* [Espresso](https://github.com/oracle/graal/tree/master/espresso), a meta-circular Java bytecode interpreter. *
1313
* [FastR](https://github.com/graalvm/fastr), an implementation of GNU R. *
14-
* [Graal.js](https://github.com/graalvm/graaljs), an ECMAScript 2020 compliant JavaScript implementation. *
14+
* [GraalJS](https://github.com/graalvm/graaljs), an ECMAScript-compliant JavaScript implementation. *
1515
* [GraalPy](https://github.com/graalvm/graalpython), an early-stage implementation of Python. *
1616
* [GraalWasm](https://github.com/oracle/graal/tree/master/wasm), a compliant WebAssembly implementation. *
1717
* [grCUDA](https://github.com/NVIDIA/grcuda), a polyglot CUDA integration.

truffle/docs/README.md

+16-21
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,19 @@ permalink: /graalvm-as-a-platform/language-implementation-framework/
99
The Truffle language implementation framework (Truffle) is an open source library for building tools and programming languages implementations as interpreters for self-modifying Abstract Syntax Trees.
1010
Together with the open source [Graal compiler](https://github.com/oracle/graal/tree/master/compiler), Truffle represents a significant step forward in programming language implementation technology in the current era of dynamic languages.
1111

12-
The Truffle bits are uploaded to [Maven central](https://mvnrepository.com/artifact/org.graalvm.truffle).
12+
The Truffle artifacts are uploaded to [Maven central](https://mvnrepository.com/artifact/org.graalvm.truffle).
1313
You can use them from your `pom.xml` file as:
1414

1515
```xml
1616
<dependency>
1717
<groupId>org.graalvm.truffle</groupId>
1818
<artifactId>truffle-api</artifactId>
19-
<version>22.1.0</version> <!-- or any later version -->
19+
<version>24.0.2</version> <!-- or any later version -->
2020
</dependency>
2121
<dependency>
2222
<groupId>org.graalvm.truffle</groupId>
2323
<artifactId>truffle-dsl-processor</artifactId>
24-
<version>22.1.0<</version>
24+
<version>24.0.2</version>
2525
<scope>provided</scope>
2626
</dependency>
2727
```
@@ -33,45 +33,39 @@ It simplifies language implementation by automatically deriving high-performance
3333

3434
### Getting Started
3535

36-
Information on how to get starting building your language can be found in the [Language Implementation Tutorial](./LanguageTutorial.md).
37-
The reference API documentation is available as part of the [Truffle Javadoc](http://graalvm.org/truffle/javadoc/).
38-
Start with looking at the [TruffleLanguage](http://www.graalvm.org/truffle/javadoc/com/oracle/truffle/api/TruffleLanguage.html) class, which one should subclass to start developing a language.
39-
Truffle comes prebuilt with the Graal Compiler and several language implementations as part of GraalVM.
36+
We provide extensive [Truffle API documentation](http://graalvm.org/truffle/javadoc/).
37+
Start by looking at the [TruffleLanguage](http://www.graalvm.org/truffle/javadoc/com/oracle/truffle/api/TruffleLanguage.html) class, which you should subclass to start developing a language.
38+
Truffle comes with the Graal Compiler and several language implementations as part of GraalVM.
4039

4140
A good way to start implementing your language with Truffle is to fork the [SimpleLanguage](https://github.com/graalvm/simplelanguage) project and start hacking.
4241
SimpleLanguage is a relatively small language implementation, well-documented, and designed to demonstrate most of the Truffle features.
4342
You could also try by looking at code in one of the existing open source languages [implementations and experiments](./Languages.md).
4443

45-
Consider reading [these publications](https://github.com/oracle/graal/blob/master/docs/Publications.md) for a very detailed view into how many of the aspects of Truffle work. However, as with any other software project, the source code is the ground truth.
46-
4744
### Advanced Topics
4845

4946
Implementing a language using Truffle offers a way to interoperate with other "Truffle" languages.
50-
To learn more about verifying that your language is a valid polyglot citizen, read more about using the [Polyglot TCK](./TCK.md).
51-
Somewhat related topics worth exploring are [Truffle Libraries](./TruffleLibraries.md), as well as how to use them to implement a language [interoperability](./InteropMigration.md).
47+
To estimate if your language is a valid polyglot citizen, read about using the [Polyglot API-based Test Compatibility Kit](./TCK.md).
48+
Somewhat related topics worth exploring are [Truffle Libraries](./TruffleLibraries.md), as well as how to use them to implement a [language interoperability](./InteropMigration.md).
5249
Languages implemented with Truffle can also be embedded in Java host applications using the [Polyglot API](../../docs/reference-manual/embedding/embed-languages.md).
5350

54-
To better understand how to improve the performance of your language please consult the documentation on [profiling](./Profiling.md) and [optimizing](./Optimizing.md) your language.
55-
Also, to better understand how to use Truffle's automated monomorphization feature (i.e., splitting), look at the [related documentation](./splitting/Monomorphization.md).
51+
To better understand how to improve the performance of your language, see the documentation on [Profiling Truffle Interpreters](./Profiling.md) and [Optimizing Truffle Interpreters](./Optimizing.md).
52+
Also, to better understand how to use Truffle's automated monomorphization feature (for example, splitting), look at the [related documentation](./splitting/Monomorphization.md).
5653

5754
## Implement Your Tool
5855

59-
GraalVM provides a framework for creating language-agnostic tools like debuggers, profilers, and other instrumentations.
60-
In general, GraalVM provides a standardized way to express and run program code enabling cross-language research and the development of tools that can be developed once and then applied to any language.
61-
62-
The reference API documentation is available as part of the [Truffle Javadoc](http://graalvm.org/truffle/javadoc/).
56+
With the Truffle framework, you can develop language-agnostic tools such as debuggers, profilers, and other instrumentations.
6357
Start with looking at the [TruffleInstrument](https://www.graalvm.org/truffle/javadoc/com/oracle/truffle/api/instrumentation/TruffleInstrument.html) class, which -- similar to `TruffleLanguage` -- one should subclass to start developing a tool.
6458

6559
If you want to implement your own "Truffle" tool, a good way to start is to fork the [SimpleTool](https://github.com/graalvm/simpletool) project -- like the SimpleLanguage project described above -- and start hacking.
6660
SimpleTool is a well-documented, minimalistic code-coverage tool designed to be a starting point for understanding the tool development process using Truffle.
6761

68-
Since tools, developed with Truffle, instrument the language using the same AST-node-based approach, most of the techniques available to language developers in terms of improving performance are available to the tool developers as well.
69-
This is why it is recommended that you understand how Truffle works from a language developer's perspective, in order to get the maximum out of your tool.
62+
Since tools, developed with Truffle, instrument the language using the same AST-node-based approach, most of the techniques available to language developers, in terms of improving performance, are available to the tool developers as well.
63+
This is why it is recommended that you understand how Truffle works from a language developer's perspective to get the maximum out of your tool.
7064

7165
## Compatibility
7266

7367
The Truffle API is evolved in a backwards-compatible manner from one version to the next.
74-
When an API is deprecated, then it will stay deprecated for at least [two GraalVM releases](https://www.graalvm.org/release-notes/version-roadmap/), and a minimum of one month, before it will be removed.
68+
When an API is deprecated, then it will stay deprecated for at least [two GraalVM releases](https://www.graalvm.org/release-calendar/) before it will be removed.
7569

7670
As a best practice it is recommended to upgrade Truffle only one version at a time.
7771
This way you can increment the version and fix deprecation warnings before continuing to the next version.
@@ -81,4 +75,5 @@ The latest additions and changes can be seen in the [changelog](https://github.c
8175

8276
## Modifying Truffle
8377

84-
To understand how to modify Truffle, consult [this file](https://github.com/oracle/graal/blob/master/truffle/README.md), and if you would like to contribute to Truffle, consult the [contribution documentation](https://github.com/oracle/graal/blob/master/truffle/CONTRIBUTING.md).
78+
To understand how to modify Truffle, check [this file](https://github.com/oracle/graal/blob/master/truffle/README.md).
79+
If you would like to contribute to Truffle, consult the [contribution documentation](https://github.com/oracle/graal/blob/master/truffle/CONTRIBUTING.md).

0 commit comments

Comments
 (0)