Skip to content

Commit 611d78f

Browse files
authored
Merge pull request #46 from jecisc/customizableimporter
Introduce a set of tool to improve FAST importer development
2 parents e621baf + c06b2fe commit 611d78f

26 files changed

Lines changed: 2265 additions & 215 deletions

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
runs-on: ubuntu-latest
1919
strategy:
2020
matrix:
21-
smalltalk: [ Pharo64-13 ]
21+
smalltalk: [ Pharo64-13, Pharo64-14 ]
2222
name: ${{ matrix.smalltalk }}
2323
steps:
2424
- uses: actions/checkout@v4

README.md

Lines changed: 54 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,30 @@
77
This project provides **Pharo bindings to [Tree-sitter](https://tree-sitter.github.io/tree-sitter/)**.
88
It allows you to analyze and highlight code using existing Tree-sitter parsers developed by the community.
99

10+
11+
<!-- TOC -->
12+
13+
- [Pharo Tree-Sitter](#pharo-tree-sitter)
14+
- [Installation](#installation)
15+
- [Native Libraries Required](#native-libraries-required)
16+
- [Automated Library Generation](#automated-library-generation)
17+
- [How It Works](#how-it-works)
18+
- [Required Tools for MacOS and Linux](#required-tools-for-macos-and-linux)
19+
- [Required Tools for Windows](#required-tools-for-windows)
20+
- [Manual Installation](#manual-installation)
21+
- [macOS](#macos)
22+
- [Building Tree-sitter Shared Library](#building-tree-sitter-shared-library)
23+
- [Archlinux](#archlinux)
24+
- [Quick Example](#quick-example)
25+
- [Moose: TreeSitter to build FAST and Famix models](#moose-treesitter-to-build-fast-and-famix-models)
26+
- [Utilities and Debugging](#utilities-and-debugging)
27+
- [Pre-built Libraries (Temporary Solution)](#pre-built-libraries-temporary-solution)
28+
- [Create a new FASTLanguageMetamodel using PharoTreeSitter](#create-a-new-fastlanguagemetamodel-using-pharotreesitter)
29+
30+
<!-- /TOC -->
31+
32+
## Installation
33+
1034
To install it in **Pharo**, run the following script in a Playground:
1135

1236
```smalltalk
@@ -16,6 +40,14 @@ Metacello new
1640
load.
1741
```
1842

43+
To add this project to your baseline you can copy paste:
44+
45+
```Smalltalk
46+
spec
47+
baseline: 'TreeSitter'
48+
with: [ spec repository: 'github://Evref-BL/Pharo-Tree-Sitter:main/src' ]
49+
```
50+
1951
## Native Libraries Required
2052

2153
To function correctly, the following native libraries are required depending on your OS:
@@ -131,24 +163,6 @@ So you only have to install tree-sitter and the grammar you wanna use with your
131163
yay tree-sitter tree-sitter-grammars
132164
```
133165

134-
135-
## Debug
136-
137-
You might want to debug a tree sitter parser from Pharo.
138-
Whereas we did not find _yet_ a way to use the pharo debugger.
139-
You can create a logger attached to the parser.
140-
141-
```st
142-
callback := (TSLogCallback on: [ :payload :log_type :buffer | Transcript crShow: buffer ] ).
143-
logger := TSLogger new log: callback .
144-
parser logger: logger.
145-
```
146-
147-
## Pre-built Libraries (Temporary Solution)
148-
149-
If you face issues building the libraries, you can download pre-built libraries (for Windows and macOS) here:
150-
https://doi.org/10.5281/zenodo.15423234
151-
152166
## Quick Example
153167

154168
Here is a basic usage example in Pharo:
@@ -161,6 +175,28 @@ tree := parser parseString: string.
161175
tree rootNode
162176
```
163177

178+
## Moose: TreeSitter to build FAST and Famix models
179+
180+
[`Moose`](https://github.com/moosetechnology/Moose)is a software analysis platform. It can manage two kinds of models:
181+
- Famix been a dependency model
182+
- FAST (Famix AST) been an AST representation of the language
183+
184+
It exist some utilities to help building a Famix model for a language supported by TreeSitter. You can find this project here: [https://github.com/moosetechnology/TreeSitterFamixIntegration](https://github.com/moosetechnology/TreeSitterFamixIntegration)
185+
186+
And this project provides a way to easily create a FAST importer. You can find the documentation here: [Documentation](resources/doc/fast_importer.md)
187+
188+
## Utilities and Debugging
189+
190+
This project provides a few utilities to help you debug a tree sitter parser or to help you with its manipulation.
191+
192+
Those utilises are documented here: [Documentation](resources/doc/ts_utilities.md)
193+
194+
## Pre-built Libraries (Temporary Solution)
195+
196+
If you face issues building the libraries, you can download pre-built libraries (for Windows and macOS) here:
197+
https://doi.org/10.5281/zenodo.15423234
198+
199+
164200
# Create a new FASTLanguageMetamodel using PharoTreeSitter
165201

166202
This library allows you to create a first version of any FASTLanguageMetamodel, in condition that this language is supported by treesitter and by PharoTreeSitter. To do that you can follow a detailed documentation [here](https://modularmoose.org/blog/2025-09-16-generation-of-fast-metamodel-using-treesitter/).
425 KB
Loading
558 KB
Loading

resources/doc/basicMM.png

2.28 MB
Loading

0 commit comments

Comments
 (0)