Skip to content

PeterHovanec/SLANG

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SLANG — Semantics-Based Language Generator

Copyright (c) 2023
https://www.risc.jku.at/research/formal/software/SLANG

Authors


License

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 3 or later.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see
https://www.gnu.org/licenses/.


Overview

SLANG is a software system for generating rapid prototype implementations of programming languages from their formal specifications.

From a single textual specification, SLANG can generate:

  • A parser (using ANTLR4) that converts concrete syntax into an AST
  • A pretty printer that converts the AST back to concrete syntax
  • A type checker, generated from formal inference rules
  • An interpreter, generated from
    • denotational semantics (function equations), and/or
    • big-step operational semantics (transition rules)

SLANG is implemented in Java and generates Java source code, but is designed to be extensible to other target languages.

Project page:
https://www.risc.jku.at/research/formal/software/SLANG


Distribution Contents

README          This file
COPYING         GNU General Public License v3
CHANGES         Version history
bin/
  SLANG         Execution script
lib/
  antlr4.jar    ANTLR4 library (complete version)
  SLANG.jar     SLANG library
doc/
  main.pdf      Manual
languages/
  <L>.txt       Sample language definition
  <L>Main.java  Main program for executing the language
  <L>Make       Script to generate the executable
  <L>           Script to run the executable
  lang/*/*      Java and .g4 files generated by SLANG
src/
  slang/*.java  SLANG source code

Installation

Requirements

  • Java Development Kit (JDK) 21 or newer

Older Java versions will not work, as SLANG uses:

  • record patterns
  • pattern matching for switch

Setup

  1. Copy bin/SLANG into a directory listed in your PATH
  2. Edit bin/SLANG:
    • Set JAVA to the path of the java executable
    • Set SLANG to point to the lib directory of the distribution
  3. Verify the installation:
SLANG -h
  1. See the examples in the languages/ directory
    (start with the <L>Make scripts)

Third-Party Software (Required)

Java Development Kit 21+

Oracle JDK 21 is recommended.

Download:
https://www.oracle.com/java/technologies/downloads/

Debian GNU/Linux

Debian 13 (trixie):

apt-get install openjdk-21-jdk

Debian 12 (bookworm): Available via backports: https://backports.debian.org


Third-Party Software (Included)

ANTLR 4.13.0

Website:
https://www.antlr.org

ANTLR is used for:

  • processing the SLANG language
  • processing ANTLR grammars generated by SLANG

Debian GNU/Linux

apt-get install antlr4

End of README

About

The SLANG Semantics-Based Language Generator

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published