A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/AdaCore/langkit below:

GitHub - AdaCore/langkit: Language creation framework.

Langkit (nickname for language kit) is a tool whose purpose is to make it easy to create syntactic and semantic analysis engines. Write a language specification in our Python DSL and Langkit will generate for you an Ada library with bindings for the C and Python programming languages.

The generated library is meant to provide a basis to write tooling, including tools working on potentially changing and incorrect code, such as IDEs.

The currently main Langkit user is Libadalang, a high performance semantic engine for the Ada programming language.

To use Langkit, you will need:

For all Ada libraries (GNATcoll, VSS, Prettier-Ada, AdaSAT), make sure to install the version that corresponds to the version of Langkit that is built. For instance, build all 24.1 branches, or all master branches. Mixing versions is not supported.

We assume below that all the Ada dependencies are installed under the $PREFIX directory, and that the environment is properly set up to use it:

First, clone the adasat repository in the langkit subdirectory of the langkit repository:

$ (cd langkit; git clone https://github.com/AdaCore/adasat)

Then, install the Langkit Python package itself:

Build the Liblktlang support library:

$ python manage.py make --no-mypy --library-types=static,static-pic,relocatable

Install the Langkit_Support library:

$ python manage.py install-langkit-support $PREFIX --library-types=static,static-pic,relocatable

Install the Liblktlang support library:

$ python -m langkit.scripts.lkm install -c lkt/langkit.yaml $PREFIX --library-types=static,static-pic,relocatable --disable-all-mains
$ pip install lkt/build/python

If you are interested in shared (relocatable) libraries only, you can omit the --library-types arguments.

In order to run the testsuite, launch the following command from the top-level directory:

This is just a wrapper passing convenient options to the real testsuite driver that is in testsuite/testsuite.py.

Note that even though the testsuite framework requires Python 3.11, it is possible to run the tests themselves using a different Python interpreter. For instance, to run them using Python 3.7, run:

$ python manage.py test --with-python=python3.7

If you want to learn more about this test driver's options (for instance to run tests under Valgrind), add a -h flag.

The developer and user's documentation for Langkit is in langkit/doc. You can consult it as a text files or you can build it. For instance, to generate HTML documents, run from the top directory:

And then open the following file in your favorite browser:

doc/_build/html/index.html
Bootstrapping a new language engine

Nothing is more simple than getting an initial project skeleton to work on a new language engine. Imagine you want to create an engine for the Foo language, run from the top-level directory:

$ python -m langkit.scripts.create_project Foo

This creates a langkit.yaml configuration file in the current directory as well as a foo directory with Lkt sources for a minimal lexer and parser, that you can build with:

$ python -m langkit.scripts.lkm make

Here you are!

Langkit uses mako templates generating Ada, C and Python code. This can be hard to read. To ease development, Vim syntax files are available under the utils directory (see makoada.vim, makocpp.vim). Install them in your $HOME/.vim/syntax directory to get automatic highlighting of the template files.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4