Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix reference to TypeFox orga projects #262

Merged
merged 1 commit into from
Nov 6, 2024
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 @@ -11,7 +11,7 @@ In this tutorial we'll be going over how to build a VSIX extension (VSCode exten

## Setting up the Scripts

To get started, you'll want to have a language expressed in Langium, such as [Lox](https://github.com/langium/langium-lox) or [MiniLogo](https://github.com/langium/langium-minilogo). If you have been following along with these tutorials, you should already have something ready. If you don't you can also use the default language generated by the yeoman generator for Langium, presented in the [workflow](/docs/learn/workflow/) section.
To get started, you'll want to have a language expressed in Langium, such as [Lox](https://github.com/TypeFox/langium-lox) or [MiniLogo](https://github.com/TypeFox/langium-minilogo). If you have been following along with these tutorials, you should already have something ready. If you don't you can also use the default language generated by the yeoman generator for Langium, presented in the [workflow](/docs/learn/workflow/) section.

Regardless of what you're working with, you'll want to make sure you have the following scripts in your **package.json**.

Expand Down
2 changes: 1 addition & 1 deletion hugo/content/docs/learn/minilogo/customizing_cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ aliases:

{{< toc format=html >}}

In this tutorial, we'll be talking about customizing the command line interface for your language. We recommend reading through previous tutorials about [writing a grammar](/docs/learn/minilogo/writing_a_grammar) and [validation](/docs/learn/minilogo/validation). Once you have a good grasp on those concepts, then you should be all set for setting up a CLI. We will also continue to use the [MiniLogo](https://github.com/langium/langium-minilogo) language as a motivating example.
In this tutorial, we'll be talking about customizing the command line interface for your language. We recommend reading through previous tutorials about [writing a grammar](/docs/learn/minilogo/writing_a_grammar) and [validation](/docs/learn/minilogo/validation). Once you have a good grasp on those concepts, then you should be all set for setting up a CLI. We will also continue to use the [MiniLogo](https://github.com/TypeFox/langium-minilogo) language as a motivating example.

## Overview

Expand Down
2 changes: 1 addition & 1 deletion hugo/content/docs/learn/minilogo/generation.md
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ our JSON output should be:
]
```

If you're looking at the implementation of [MiniLogo that we've already written in the Langium organization on Github](https://github.com/langium/langium-minilogo), you may notice that the program and output there are *slightly* different. This interpretation of MiniLogo has gone through some iterations, and so there are some slight differences here and there. What's most important is that your version produces the generated output that you expect.
If you're looking at the implementation of [MiniLogo that we've already written in the Langium organization on Github](https://github.com/TypeFox/langium-minilogo), you may notice that the program and output there are *slightly* different. This interpretation of MiniLogo has gone through some iterations, and so there are some slight differences here and there. What's most important is that your version produces the generated output that you expect.

We could continue to extend on this with new features, and generate new sorts of output using a given input language. In this tutorial, we're able to take a MiniLogo program and convert it into some simple JSON drawing instructions that can be consumed by another program. This opens the door for us to write such a program in another language, such as Python or Javascript, and draw with these results. In later tutorials, we'll be talking about how to run Langium in the web with generation, so that we can immediately verify our results by drawing on an HTML5 canvas.

Expand Down
2 changes: 1 addition & 1 deletion hugo/content/docs/learn/minilogo/generation_in_the_web.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ In this tutorial we'll be talking about how to perform generation in the web by

*(This tutorial previously utilized custom LSP commands to achieve the same goal of generation. This is still a valid approach, but we've found setting up listening for notifications this way is much more straightforward. We've implemented this in our own example languages as well, and would recommend it going forward.)*

We'll assume that you've already looked over most of the other tutorials at this point. It is particularly important that you have a language with working generation, and have a working instance of Langium + Monaco for your language (or another editor of your choice). In the case that you don't have a language to work with, you can follow along with [MiniLogo](https://github.com/langium/langium-minilogo), which is the example language used throughout many of these tutorials.
We'll assume that you've already looked over most of the other tutorials at this point. It is particularly important that you have a language with working generation, and have a working instance of Langium + Monaco for your language (or another editor of your choice). In the case that you don't have a language to work with, you can follow along with [MiniLogo](https://github.com/TypeFox/langium-minilogo), which is the example language used throughout many of these tutorials.

Since we're working with MiniLogo here, we already know that our generated output is in the form of drawing instructions that transform some drawing context. The generated output that we've implemented so far consists of a JSON array of commands, making it very easy to interpret. Now that we're working in a web-based context, this approach lends itself naturally towards manipulating an HTML5 canvas.

Expand Down
2 changes: 1 addition & 1 deletion hugo/content/docs/learn/minilogo/langium_and_monaco.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Without further ado, let's jump into getting your web-based Langium experience s

## Getting your Language Setup for the Web

To begin, you're going to need a Langium-based language to work with. We have already written [MiniLogo](https://github.com/langium/langium-minilogo) in Langium as an example for deploying a language in the web. However, if you've been following along with these tutorials so far, you should be ready to move your own language into a web-based context.
To begin, you're going to need a Langium-based language to work with. We have already written [MiniLogo](https://github.com/TypeFox/langium-minilogo) in Langium as an example for deploying a language in the web. However, if you've been following along with these tutorials so far, you should be ready to move your own language into a web-based context.

Per usual, we'll be using MiniLogo as the motivating example here.

Expand Down
2 changes: 1 addition & 1 deletion hugo/content/docs/learn/minilogo/validation.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ aliases:

In this tutorial, we will be talking about implementing validation for your Langium-based language. We recommend first reading the previous tutorial about [writing a grammar](/docs/learn/minilogo/writing_a_grammar/), as we will assume you're familiar with the topics covered there. We'll also assume that you have a working language to add validation to, so double check that `npm run langium:generate` succeeds without errors before you proceed.

For this tutorial, we'll be implementing validation for the [MiniLogo language](https://github.com/langium/langium-minilogo), but you can use your own language to follow along as well.
For this tutorial, we'll be implementing validation for the [MiniLogo language](https://github.com/TypeFox/langium-minilogo), but you can use your own language to follow along as well.

## Overview

Expand Down
2 changes: 1 addition & 1 deletion hugo/content/docs/learn/minilogo/writing_a_grammar.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ aliases:

In this tutorial we will be talking about writing a grammar for your language in Langium. As a motivating example, we'll be describing how to write a grammar for the MiniLogo language. If you're not familiar with MiniLogo, it's a smaller implementation of the Logo programming language. Logo itself is a lot like Turtle from Python. Ultimately, we'll be using MiniLogo to express drawing instructions that can be used to draw on a canvas.

We've already written an implementation of [MiniLogo on Github using Langium](https://github.com/langium/langium-minilogo). This tutorial will be following along with this project, by walking through the grammar implementation step by step. Later tutorials will also follow along with MiniLogo to create an easy to follow series.
We've already written an implementation of [MiniLogo on Github using Langium](https://github.com/TypeFox/langium-minilogo). This tutorial will be following along with this project, by walking through the grammar implementation step by step. Later tutorials will also follow along with MiniLogo to create an easy to follow series.

## Planning

Expand Down
4 changes: 2 additions & 2 deletions hugo/content/docs/recipes/scoping/class-member.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function test(): void {

Member based scoping like this requires not only a modification of the default scoping provider, but also some other prerequisites.
This includes adding a member call mechanism in your grammar and a rudimentary type system.
For this guide, we will use excerpts from the [langium-lox](https://github.com/langium/langium-lox) project to demonstrate how you can set this up yourself.
For this guide, we will use excerpts from the [langium-lox](https://github.com/TypeFox/langium-lox) project to demonstrate how you can set this up yourself.
This project implements a strongly-typed version of the [Lox language](https://craftinginterpreters.com/the-lox-language.html) from the popular book [Crafting Interpreters](https://craftinginterpreters.com/).

We'll first start with the `MemberCall` grammar rule, which references one of our `NamedElements`. These elements could be variable declarations, functions, classes or methods and fields of those classes. Additionally, we want to allow function calls on elements. Note that the grammar has no notion of whether these elements can actually be executed as functions. Instead, we always allow function calls on every named element, and simply provide validation errors in case an element is called erroneously. After parsing the first member call, we continue parsing further members as long as the input text provides us with further references to elements; which are separated by dots.
Expand Down Expand Up @@ -99,7 +99,7 @@ export class LoxScopeProvider extends DefaultScopeProvider {
}
```

When trying to compute the type of an expression, we are only interested in the final piece of the member call. However, to derive the type and scope of the final member call, we have to recursively identify the type of the previous member call. This is done by looking at the member call stored in the `previous` property and inferring its type. See [here for the full implementation of the type inference system in Lox](https://github.com/langium/langium-lox/blob/main/src/language-server/type-system/infer.ts). This kind of type inference requires scoping.
When trying to compute the type of an expression, we are only interested in the final piece of the member call. However, to derive the type and scope of the final member call, we have to recursively identify the type of the previous member call. This is done by looking at the member call stored in the `previous` property and inferring its type. See [here for the full implementation of the type inference system in Lox](https://github.com/TypeFox/langium-lox/blob/main/langium/src/language-server/type-system/infer.ts). This kind of type inference requires scoping.

To illustrate this behavior a bit better, take a look at the following code snippet:

Expand Down
Loading