vmf-text

VMF-Text

License

License

GroupId

GroupId

eu.mihosoft.vmf
ArtifactId

ArtifactId

vmf-text
Last Version

Last Version

0.1.2
Release Date

Release Date

Type

Type

jar
Description

Description

vmf-text
VMF-Text
Project URL

Project URL

https://github.com/miho/VMF-Text
Source Code Management

Source Code Management

https://github.com/miho/VMF-Text.git

Download vmf-text

How to add to project

<!-- https://jarcasting.com/artifacts/eu.mihosoft.vmf/vmf-text/ -->
<dependency>
    <groupId>eu.mihosoft.vmf</groupId>
    <artifactId>vmf-text</artifactId>
    <version>0.1.2</version>
</dependency>
// https://jarcasting.com/artifacts/eu.mihosoft.vmf/vmf-text/
implementation 'eu.mihosoft.vmf:vmf-text:0.1.2'
// https://jarcasting.com/artifacts/eu.mihosoft.vmf/vmf-text/
implementation ("eu.mihosoft.vmf:vmf-text:0.1.2")
'eu.mihosoft.vmf:vmf-text:jar:0.1.2'
<dependency org="eu.mihosoft.vmf" name="vmf-text" rev="0.1.2">
  <artifact name="vmf-text" type="jar" />
</dependency>
@Grapes(
@Grab(group='eu.mihosoft.vmf', module='vmf-text', version='0.1.2')
)
libraryDependencies += "eu.mihosoft.vmf" % "vmf-text" % "0.1.2"
[eu.mihosoft.vmf/vmf-text "0.1.2"]

Dependencies

compile (6)

Group / Artifact Type Version
eu.mihosoft.vmf : vmf-runtime jar 0.1.1
org.antlr : antlr4 jar 4.7
org.apache.velocity : velocity jar 1.7
eu.mihosoft.vmf : vmf jar 0.1.1
org.mdkt.compiler : InMemoryJavaCompiler jar 1.3.0
org.codehaus.groovy : groovy jar 2.4.12

Project Modules

There are no modules declared in this project.

VMF-Text Tweet

Download Build Status Build status Join the chat at https://gitter.im/VMF_/Lobby

VMF-Text is a novel framework for grammar-based language modeling on the Java Platform (it works with Java 8, 9, 10 and 11): give it a labeled ANTLR4 grammar and it will generate a rich and clean API (based on VMF) for (un)parsing and transforming custom textual languages. The complete API is derived from just a single ANTLR4 grammar file!

Using VMF-Text

Checkout the tutorial projects: https://github.com/miho/VMF-Text-Tutorials

VMF-Text comes with excellent Gradle support. Just add the plugin like so (click here to get the latest version):

plugins {
  id "eu.mihosoft.vmftext" version "0.1.2.7" // use latest version
}

(optionally) configure VMF-Text:

vmfText {
    vmfVersion   = '0.1.1'   // (runtime version)
    antlrVersion = '4.7.1' // (runtime version)
}

Now just add the labeled ANTLR4 grammar file to the VMF-Text source folder, e.g.:

src/main/vmf-text/my/pkg/ArrayLang.g4

Sample grammar for parsing strings of the form (1,2,3):

grammar ArrayLang;

array:  '(' values+=INT (',' values+=INT)* ')' EOF;

INT: SIGN? DIGIT+
   ;

fragment SIGN :'-' ;
fragment DIGIT : [0-9];

WS
    : [ \t\r\n]+ -> channel(HIDDEN)
    ;

/*<!vmf-text!>
TypeMap() {
  (INT    -> java.lang.Integer) = 'java.lang.Integer.parseInt(entry.getText())'
}
*/

Finally, call the vmfTextGenCode task to generate the implementation.

Building VMF-Text (Core)

Requirements

  • Java >= 1.8
  • Internet connection (dependencies are downloaded automatically)
  • IDE: Gradle Plugin (not necessary for command line usage)

IDE

Open the VMF-Text/core Gradle project in your favourite IDE (tested with NetBeans 8.2 and IntelliJ 2018) and build it by calling the publishToMavenLocal task.

Command Line

Navigate to the Gradle project (i.e., path/to/VMF-Text/core) and enter the following command

Bash (Linux/macOS/Cygwin/other Unix shell)

bash gradlew publishToMavenLocal

Windows (CMD)

gradlew publishToMavenLocal

Building VMF-Text (Gradle Plugin)

Requirements

  • Java >= 1.8
  • Internet connection (dependencies are downloaded automatically)
  • IDE: Gradle Plugin (not necessary for command line usage)

IDE

Open the VMF-Text/gradle-plugin Gradle project in your favourite IDE (tested with NetBeans 8.2 and IntelliJ 2018) and build it by calling the publishToMavenLocal task.

Command Line

Navigate to the Gradle project (i.e., path/to/VMF-Text/gradle-plugin) and enter the following command

Bash (Linux/macOS/Cygwin/other Unix shell)

bash gradlew publishToMavenLocal

Windows (CMD)

gradlew publishToMavenLocal 

Testing VMF-Text (Core & Plugin)

To execute the test suite, navigate to the test project (i.e., path/to/VMF-Text/test-suite) and enter the following command

Bash (Linux/macOS/Cygwin/other Unix shell)

bash gradlew test

Windows (CMD)

gradlew test

This will use the latest snapshot vmf-text and gradle-plugin to execute the tests defined in the test-suite project.

Viewing the Report

An HTML version of the test report is located in the build folder test-suite/build/reports/tests/test/index.html.

Test reports of the travis builds are available as well: [Test reports]

Versions

Version
0.1.2
0.1