Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#18 Implemented CEX Witness serialization #41

Merged
merged 27 commits into from
Jan 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
ad87cfc
#34 Updated JDK to 21
arminzavada Nov 5, 2024
99d3c6f
#18 Added Cex language support
arminzavada Nov 5, 2024
65aae5d
#18 Renamed Serializer to XstsSerializer
arminzavada Nov 7, 2024
4d7584d
#18 Added CexReader
arminzavada Nov 7, 2024
b281786
Added SignedInt rule
arminzavada Nov 7, 2024
5e650b0
Fixed MissionWitness incorrect references
arminzavada Nov 8, 2024
89f3b62
Optimized Utility functions
arminzavada Nov 8, 2024
8853362
Implemented initial OXSTS formatter
arminzavada Nov 8, 2024
33239c6
Added Namings helper object for common naming
arminzavada Nov 12, 2024
0362722
Using $ to signify synthetic element names
arminzavada Nov 12, 2024
bbea688
Added SignedInt to Cex
arminzavada Nov 12, 2024
295ebe4
Added additional formattings to OXSTS
arminzavada Nov 12, 2024
0696fd4
Extracted Oxsts logic from OxstsScopeProvider
arminzavada Nov 12, 2024
30a971d
Added basic Cex Witness generator
arminzavada Nov 12, 2024
1a0d016
Added Summary generation (default)
arminzavada Nov 13, 2024
3049152
Added generateWitness as flag option
arminzavada Nov 13, 2024
5432165
Drop was skipping the first state, not the first transition state
arminzavada Nov 13, 2024
29d2a19
States are now optional to support short witnesses
arminzavada Nov 13, 2024
25b5ce6
Use the original package name instead of a new one
arminzavada Nov 13, 2024
c2945be
Added additional formatting to OxstsFormatter
arminzavada Nov 13, 2024
128e83b
Filtering check should not assume anything
arminzavada Nov 13, 2024
91f0f5d
#18 Node download, skip vsce package
arminzavada Nov 26, 2024
3935b8b
#18 Updated CEX Witness creator
arminzavada Jan 23, 2025
5dca2d5
Updated PetriNet model
arminzavada Jan 23, 2025
93a749a
Added missing input dependency
arminzavada Jan 23, 2025
ed4ba58
Refactored OXSTS model optimization
arminzavada Jan 23, 2025
53c4699
Updated expected models
arminzavada Jan 23, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: 17
java-version: 21
distribution: adopt
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dependency.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
java-version: 21

- name: Generate and submit dependency graph
uses: gradle/actions/dependency-submission@v4
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ A framework to support the declarative definition of engineering model semantics

## Build

Use Java 17 for building.
Use Java 21 for building.

Run `gradlew build` to assemble the whole project, and execute all automated test, including regression testing and formal verifications. The required environment (e.g., Theta binaries) is automatically constructed by Gradle. Tests should run in a few minutes.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ dependencies {
}

java.toolchain {
languageVersion.set(JavaLanguageVersion.of(17))
languageVersion.set(JavaLanguageVersion.of(21))
}

tasks {
Expand Down
2 changes: 2 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ include(
"semantifyr",
"xsts.lang",
"xsts.lang.ide",
"cex.lang",
"cex.lang.ide",
"oxsts.model",
"oxsts.lang",
"oxsts.lang.ide",
Expand Down
6 changes: 6 additions & 0 deletions subprojects/cex.lang.ide/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# SPDX-FileCopyrightText: 2023-2024 The Semantifyr Authors
#
# SPDX-License-Identifier: EPL-2.0

/src/main/xtext-gen/
!.gitignore
56 changes: 56 additions & 0 deletions subprojects/cex.lang.ide/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/*
* SPDX-FileCopyrightText: 2023-2024 The Semantifyr Authors
*
* SPDX-License-Identifier: EPL-2.0
*/

plugins {
id("hu.bme.mit.semantifyr.gradle.xtext-generated")
id("hu.bme.mit.semantifyr.gradle.conventions.application")
}

val ideGeneratedClasspath by configurations.creating {
isCanBeConsumed = false
isCanBeResolved = true
}

dependencies {
api(project(":cex.lang"))

implementation(libs.xtext.ide)
runtimeOnly(libs.slf4j.log4j)

ideGeneratedClasspath(project(":cex.lang", configuration = "ideGeneratedOutput"))
}

val distributionOutput by configurations.creating {
isCanBeConsumed = true
isCanBeResolved = false
}

artifacts {
add(distributionOutput.name, layout.buildDirectory.dir("install")) {
builtBy(tasks.installDist)
}
}

val cloneIdeGenerated by tasks.registering(Sync::class) {
inputs.files(ideGeneratedClasspath)

from(ideGeneratedClasspath.asFileTree)
into("src/main/xtext-gen")
}

listOf("compileJava", "processResources").forEach { task ->
tasks.named(task) {
inputs.files(cloneIdeGenerated.get().outputs)
}
}

tasks.clean {
delete("src/main/xtext-gen")
}

application {
mainClass = "hu.bme.mit.semantifyr.cex.lang.ide.CexIdeSetup"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/*
* SPDX-FileCopyrightText: 2023-2024 The Semantifyr Authors
*
* SPDX-License-Identifier: EPL-2.0
*/

package hu.bme.mit.semantifyr.cex.lang.ide;

/**
* Use this class to register ide components.
*/
public class CexIdeModule extends AbstractCexIdeModule {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* SPDX-FileCopyrightText: 2023-2024 The Semantifyr Authors
*
* SPDX-License-Identifier: EPL-2.0
*/

package hu.bme.mit.semantifyr.cex.lang.ide;

import com.google.inject.Guice;
import com.google.inject.Injector;
import hu.bme.mit.semantifyr.cex.lang.CexRuntimeModule;
import hu.bme.mit.semantifyr.cex.lang.CexStandaloneSetup;
import org.eclipse.lsp4j.jsonrpc.Launcher;
import org.eclipse.lsp4j.services.LanguageClient;
import org.eclipse.xtext.ide.server.LanguageServerImpl;
import org.eclipse.xtext.ide.server.ServerModule;
import org.eclipse.xtext.util.Modules2;

import java.util.concurrent.ExecutionException;

/**
* Initialization support for running Xtext languages as language servers.
*/
public class CexIdeSetup extends CexStandaloneSetup {

@Override
public Injector createInjector() {
return Guice.createInjector(Modules2.mixin(new CexRuntimeModule(), new CexIdeModule()));
}

public static void main(String[] args) throws InterruptedException, ExecutionException {
CexIdeSetup.doSetup();

Injector injector = Guice.createInjector(new ServerModule());
LanguageServerImpl languageServer = injector.getInstance(LanguageServerImpl.class);

Launcher<LanguageClient> launcher = Launcher.createLauncher(languageServer, LanguageClient.class, System.in, System.out);
languageServer.connect(launcher.getRemoteProxy());
launcher.startListening().get();
}

}
5 changes: 5 additions & 0 deletions subprojects/cex.lang.ide/src/main/resources/plugin.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# SPDX-FileCopyrightText: 2023-2024 The Semantifyr Authors
#
# SPDX-License-Identifier: EPL-2.0

_UI_DiagnosticRoot_diagnostic=Specified, so the LSP server functions correctly
7 changes: 7 additions & 0 deletions subprojects/cex.lang/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# SPDX-FileCopyrightText: 2023-2024 The Semantifyr Authors
#
# SPDX-License-Identifier: EPL-2.0

model/
/src/main/xtext-gen/
/src/testFixtures/xtext-gen/
65 changes: 65 additions & 0 deletions subprojects/cex.lang/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/*
* SPDX-FileCopyrightText: 2023-2024 The Semantifyr Authors
*
* SPDX-License-Identifier: EPL-2.0
*/

plugins {
id("hu.bme.mit.semantifyr.gradle.xtext-generated")
}

dependencies {
implementation(platform(libs.xtext.bom))
implementation(libs.xtext.core)
implementation(libs.xtext.xbase)

testFixturesApi(libs.xtext.testing)

mwe2(libs.xtext.generator)
mwe2(libs.xtext.generator.antlr)
}

val generateXtextLanguage by tasks.registering(JavaExec::class) {
mainClass.set("org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher")
classpath(configurations.mwe2)

inputs.file("src/main/java/hu/bme/mit/semantifyr/cex/lang/GenerateCex.mwe2")
inputs.file("src/main/java/hu/bme/mit/semantifyr/cex/lang/Cex.xtext")

outputs.dir("src/main/xtext-gen")
outputs.dir("src/testFixtures/xtext-gen")
outputs.dir(layout.buildDirectory.dir("generated/sources/xtext/ide"))

args("src/main/java/hu/bme/mit/semantifyr/cex/lang/GenerateCex.mwe2", "-p", "rootPath=/$projectDir/..")
}

val ideGeneratedOutput by configurations.creating {
isCanBeConsumed = true
isCanBeResolved = false
}

artifacts {
add(ideGeneratedOutput.name, layout.buildDirectory.dir("generated/sources/xtext/ide")) {
builtBy(generateXtextLanguage)
}
}

tasks {
jar {
from(sourceSets.main.map { it.allSource }) {
include("**/*.xtext")
}
}

listOf("compileJava", "processResources", "compileTestJava", "compileTestFixturesJava", "processTestFixturesResources").forEach { task ->
named(task) {
inputs.files(generateXtextLanguage.get().outputs)
}
}

clean {
delete("src/main/xtext-gen")
delete("src/test/java")
delete("src/testFixtures/xtext-gen")
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
/*
* SPDX-FileCopyrightText: 2023-2024 The Semantifyr Authors
*
* SPDX-License-Identifier: EPL-2.0
*/

grammar hu.bme.mit.semantifyr.cex.lang.Cex with org.eclipse.xtext.common.Terminals

generate cex "http://www.bme.hu/mit/2024/cex"

import "http://www.eclipse.org/emf/2002/Ecore" as Ecore

Cex:
"(" ("XstsStateSequence" | "XstsCliTracegen")
(states += XstsState)*

(edges += StateEdge)*
")"
;

StateEdge:
from=[XstsState] "->" to=[XstsState]
;

XstsState:
"(" (name=ID ":")? "XstsState" (preInit?="pre_init")? (postInit?="post_init")? (lastEnv?="last_env")? (lastInternal?="last_internal")?
state = State
")"
;

State:
ExplState
;

ExplState:
"(" "ExplState"
(variableStates += ExplVariableState)*
")"
;

ExplVariableState:
"("
variable=ID value=ExplVariableValue
")"
;

ExplVariableValue:
LiteralInteger
| LiteralBoolean
| LiteralEnum
;

LiteralEnum:
type=ID "." value=ID
;

LiteralBoolean:
value = BooleanValue
;

LiteralInteger:
value = SignedInt
;

BooleanValue returns Ecore::EBoolean:
'true' | 'false'
;

SignedInt returns Ecore::EInt:
('-')? INT
;

terminal ID: '^'?('a'..'z'|'A'..'Z'|'_'|'$') ('a'..'z'|'A'..'Z'|'_'|'0'..'9'|'$')*;
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/*
* generated by Xtext 2.36.0
*/
package hu.bme.mit.semantifyr.cex.lang;


/**
* Use this class to register components to be used at runtime / without the Equinox extension registry.
*/
public class CexRuntimeModule extends AbstractCexRuntimeModule {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
* generated by Xtext 2.36.0
*/
package hu.bme.mit.semantifyr.cex.lang;


/**
* Initialization support for running Xtext languages without Equinox extension registry.
*/
public class CexStandaloneSetup extends CexStandaloneSetupGenerated {

public static void doSetup() {
new CexStandaloneSetup().createInjectorAndDoEMFRegistration();
}
}
Loading
Loading