Skip to content

uLangs toolkit uses LLMs to generate language servers from code samples. Get instant code intelligence for any DSL with the included VSCode extension.

License

Notifications You must be signed in to change notification settings

jonaslsaa/ulangs

Repository files navigation

uLangs - Universal Language Server Toolkit

A toolkit that simplifies language server development by automating grammar and semantic analysis generation. Given sample code from any domain-specific language, uLangs generates the necessary parsing and analysis components to create a LSP server implementation. The system uses LLMs to automate the traditionally manual tasks of grammar definition and semantic rule creation.

Development Status

This project represents completed Master's thesis research in automated language server development. While the core research is finished, ongoing refinement and feature additions may occur.

Features

  • Automated LSP Generation: Creates complete language servers from code samples without manual grammar writing
  • Semantic Analysis: Extracts language rules and patterns to provide intelligent code assistance
  • Code Intelligence: Delivers syntax highlighting, completions, diagnostics, and symbol navigation
  • Extensible Pipeline: Modular design supporting both traditional (ANTLR/Prolog) and LLM-based analysis
  • Language Agnostic: Works with any textual DSL or programming language given sufficient code examples
  • Universal Client: Includes ready-to-use VSCode extension that automatically integrates with any generated language server

Project Structure

  • antlr-grammar-checker/: Contains grammar definitions and Java/Kotlin code for ANTLR parsing and error handling.
  • lsp-server/: Implements the server-side logic for handling LSP requests.
  • actions/: Contains scripts for grammar inference and query generation.
  • rules/: Prolog rules and queries for semantic analysis.
  • test-dsl/: Provides test files for various languages to validate grammar and server functionality.

Getting Started

Prerequisites

  • Node.js: Ensure that Node.js is installed on your system.
  • Java: Required for running ANTLR grammar checks.
  • SWI-Prolog: Needed for executing Prolog queries.

Installation

  1. Clone the Repository:

    git clone <repository-url>
    cd ulangs
  2. Install Dependencies:

    pnpm install
  3. Build antlr-grammar-checker

cd antlr-grammar-checker/
mvn clean install

Running the Language Server

  1. Build the universal-language-server (vscode extension):

    pnpm run build:lsp
  2. Launch the Server: Use the provided VSCode launch configurations to start the language server.

Command-Line Interface

  • Generate Prolog Query:

    pnpm run cli query <target> <lexer> <parser> [options]
  • Check Grammar:

    pnpm run cli check <directory> <extension> <lexer> <parser>
  • Infer Grammar:

    pnpm run cli infer-grammar <directory> <extension> [outputDir] [options]
  • Infer Semantic Adapter:

    pnpm run cli infer-adapter <directory> <extension> [outputDir] [options]

About

uLangs toolkit uses LLMs to generate language servers from code samples. Get instant code intelligence for any DSL with the included VSCode extension.

Resources

License

Stars

Watchers

Forks

Packages

No packages published