Skip to content

Commit

Permalink
added missing READMEs, ChangeLog, added content, added EclipseCon slides
Browse files Browse the repository at this point in the history
  • Loading branch information
JohannesMeierSE committed Dec 16, 2024
1 parent 0d684f4 commit 9b11d3f
Show file tree
Hide file tree
Showing 8 changed files with 164 additions and 5 deletions.
30 changes: 30 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Typir Change Log

We roughly follow the ideas of [semantic versioning](https://semver.org/).
Note that the versions "0.x.0" probably will include breaking changes.


## v0.1.0 (December 2024)

This is the first official release of Typir.
It serves as first version to experiment with Typir and to gather feedback to guide and improve the upcoming versions. We are looking forward to your feedback!

- [Linked issues and PRs](https://github.com/TypeFox/typir/milestone/2)
- Core implementations of the following [type-checking services](/packages/typir/src/services/):
- Assignability
- Equality
- Conversion (implicit/coercion and explicit/casting)
- Type inference
- Sub-typing
- Validation
- Caching
- [Predefined types](/packages/typir/src/kinds/) to reuse:
- Primitives
- Functions
- Classes (nominally typed)
- Top, bottom
- (some more are under development)
- Operators (which are mapped to Functions)
- Application examples:
- LOX (without lambdas)
- OX
17 changes: 17 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
# Contributing

TODO


## Communication

The following communication channels are available:

- [GitHub issues](https://github.com/TypeFox/typir/issues) - for bug reports, feature requests, etc.
- [GitHub discussions](https://github.com/TypeFox/typir/discussions) - for questions, ideas, announcements, etc.
- [Weekly Langium dev meeting](https://github.com/eclipse-langium/langium/discussions/564?sort=new) - While Typir is independent from Langium in general, you might meet some Typir developers at the Langium dev meetings.

In case you have a question, please look into the provided resources and documentations first.
If you don't find any answer there, feel free to use the discussions to get help.


## Release Process

The release process for Typir is described in [RELEASE.md](./RELEASE.md).
73 changes: 69 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,85 @@
# Typir

Engineering types for software languages in the web.
<div id="badges" align="center">

[![npm](https://img.shields.io/npm/v/typir)](https://www.npmjs.com/package/typir)
[![Build](https://github.com/TypeFox/typir/actions/workflows/actions.yml/badge.svg)](https://github.com/TypeFox/typir/actions/workflows/actions.yml)
[![Github Discussions](https://img.shields.io/badge/github-discussions-blue?logo=github)](https://github.com/TypeFox/typir/discussions)
[![Gitpod Ready-to-Code](https://img.shields.io/badge/Gitpod-ready--to--code-FFAE33?logo=gitpod)](https://gitpod.io/#https://github.com/TypeFox/typir)

</div>

---

Typir is a library for type systems and type checking for software languages in the web.

Typir is OpenSource, written in TypeScript, and follows pragmatic approaches for easing type checking in practical language engineering projects by providing default implementations for recurring problems.
As a stand-alone library, Typir provides a TypeScript-API for language engineers without an additional, external DSL for formalizing types.


## Core Features

Typir provides these core features:

- Predefined types: primitives, functions, classes, top, bottom (more are planned)
- Solutions for: circular type definitions, caching
- Meaningful and customizable error messages
- The provided default implementations are customizable by dependency injection

Typir does intentionally _not_ include ...

- rules engines and constraint solving
- formal proofs
- external DSLs for formalizing types


## NPM workspace

This repository is a NPM workspace. It contains the following packages:

- [Typir](./packages/typir/README.md) - the core package of Typir
- [Typir-Langium](./packages/typir-langium/README.md) - a integration of Typir for [Langium](https://github.com/eclipse-langium/langium)
- [Typir](./packages/typir/README.md) - the core package of Typir with default implementations for type checking services and some predefined types
- [Typir-Langium](./packages/typir-langium/README.md) - a binding of Typir for [Langium](https://github.com/eclipse-langium/langium), a language workbench for developing textual DSLs in the web,
in order to ease type checking for Langium-based languages

This repository contains the following stand-alone applications, which demonstrate how to use Typir for type checking:

- [LOX](./examples/lox/README.md) - static type checking for LOX, implemented with Typir-Langium
- [OX](./examples/ox/README.md) - a reduced version of LOX, implemented with Typir-Langium


## Tiny Typir Example

[TODO](/packages/typir/test/api-example.test.ts)


## Resources

Typir is presented in these talks:

- [LangDev'24](https://langdevcon.org/2024/program#26): [Video](https://www.youtube.com/watch?v=CL8EbJYeyTE), [slides](/resources/talks/2024-10-17-LangDev.pdf) (2024-10-17)
- [OCX/EclipseCon'24](https://www.ocxconf.org/event/778b82cc-6834-48a4-a58e-f883c5a7b8c9/agenda?session=23b97df9-0435-4fab-8a01-e0a9cf3e3831&shareLink=true): [Video](https://www.youtube.com/watch?v=WLzXAhcl-aY&list=PLy7t4z5SYNaRRGVdF83feN-_uHLwvGvgw&index=23), [slides](/resources/talks/2024-10-24-EclipseCon.pdf) (2024-10-24)


## Roadmap

The roadmap of Typir is organized with [milestones in GitHub](https://github.com/TypeFox/typir/milestones).

The roadmap include, among other, these features:

- More predefined types: structurally typed classes, lambdas, generics, constrained primitive types (e.g. numbers with upper and lower bound), ...
- Calculate types, e.g. operators whose return types depend on their current input types
- Optimized APIs to register rules for inference and validation

For the released versions of Typir, see the [CHANGELOG.md](/CHANGELOG.md).


## Contributing

Please read the [CONTRIBUTING.md](./CONTRIBUTING.md) for details on our code of conduct, and the process for submitting pull requests to us.

We also have a release process described in [RELEASE.md](./RELEASE.md).


## License

[MIT License](/LICENSE)
Typir is fully [MIT licensed](/LICENSE).
17 changes: 17 additions & 0 deletions examples/lox/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Typir applied to LOX

This package contains an adapted version of [LOX](https://craftinginterpreters.com/the-lox-language.html), [realized with Langium](https://github.com/TypeFox/langium-lox) and statically type-checked with [Typir](https://typir.org/).

Typir is used here to make LOX a statically typed language:

- Variables have one type, which is either explicitly declared (e.g. `var v1: string`) or derived from the initial value (e.g. `var v2: 2 <= 3`).
- Lox supports these types here:
- primitives: boolean, string, number, void
- Classes (nominally typed)
- Lambdas (not yet supported)
- We keep `nil`, but it can be assigned only to variables with a class or lambda as type.
Variables with primitive type and without explicit initial value have the primitive types default value.

For examples written in LOX, look at some [collected examples](./examples/) or the [test cases](./test/).

To compare the current implementation for type checking with Typir with an implementation without Typir, have a look into [this repository](https://github.com/TypeFox/langium-lox/tree/main/langium/src/language-server/type-system).
7 changes: 7 additions & 0 deletions examples/ox/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Typir applied to OX

OX is a reduced version of [LOX](/examples/lox/) in order to demonstrate type checking with [Typir](https://typir.org/) for primitives, functions and operators only.

For examples written in OX, look at some [collected examples](./examples/) or the [test cases](./test/).

Start experimenting with OX by executing the "Run Extension (OX)" launch configuration.
20 changes: 19 additions & 1 deletion packages/typir-langium/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Typir integration for Langium

Typir-Langium is a framework for type checking of languages developed with [Langium](https://langium.org).
Typir-Langium is a framework for type checking of languages developed with [Langium](https://langium.org),
the language workbench for developing textual domain-specific languages (DSLs) in the web.

## Installation

Expand All @@ -12,6 +13,23 @@ npm install typir-langium

Will follow!

Important design decisions:

- Typir-Langium does not depend on `langium/lsp`, i.e. Typir-Langium can be used even for Langium-based DSLs which don't use LSP.

Integrate Typir as additional Langium service into your DSL.

```typescript
export type MyDSLAddedServices = {
// ...
typir: LangiumServicesForTypirBinding,
// ...
}
```
In case of a [multi-language project](https://langium.org/docs/recipes/multiple-languages/), this approach enables you to manage multiple type systems in parallel by having `typir1: LangiumServicesForTypirBinding`, `typir2: LangiumServicesForTypirBinding` and so on.
## Examples
Look at the examples in the `examples` folder of the repo ([here](../../examples)). There we have some demo projects for you to get started.
Expand Down
5 changes: 5 additions & 0 deletions packages/typir/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ npm install typir

Will follow!

Important design decisions:

- Typir is a stand-alone library and has no dependencies to any existing language workbench.


## Examples

Look at the examples in the `examples` folder of the repo ([here](../../examples)). There we have some demo projects for you to get started.
Expand Down
Binary file added resources/talks/2024-10-24-EclipseCon.pdf
Binary file not shown.

0 comments on commit 9b11d3f

Please sign in to comment.