-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
203 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,18 @@ | ||
# Logic app | ||
(better name needed) | ||
# CAIR Logic Platform | ||
|
||
## Purpose | ||
The goal of this repo is to provide a platform for generic logic operations (checking for consistency, validity, explanations, etc.) by way of an easy-to-use DSL. | ||
|
||
## Mission | ||
The purpose is achieved by way of three parts: | ||
- The DSL specification and generator (`za.org.cair.logic_app`) | ||
- An IDE plugin (`za.org.cair.logic_app.ide`) | ||
- An IDE plugin (`za.org.cair.logic_app.ide`) (Not implemented) | ||
- A webapp editor (`za.org.cair.logic_app.web`) | ||
|
||
## Usage | ||
|
||
### On the CLI | ||
|
||
Xtext compilers are not typically used on the command like (like e.g. `gcc` and `javac`) so support (especially in CI contexts) is very limited. Through some shady hacks I got it working (for now). | ||
|
||
Download the compiler jar from the [CLI logic lang compiler workflow](https://github.com/Koellewe/logic-app/actions?query=workflow%3A%22Build+CLI+logic+lang+compiler%22) build artifacts. Create a file written in the specified logic language (with `.logic` as file extension). Compile as follows: | ||
|
||
```sh | ||
java -jar logic-compiler.jar example.logic | ||
``` | ||
|
||
Ignore the reflection warnings. They are caused in Java 11 onwards by a lib xtext depends on and will be updated once the developers there get their act together. [More info](https://github.com/eclipse/xtext-core/issues/506). | ||
|
||
|
||
### As library / on Web / in IDE | ||
|
||
TODO | ||
See the [wiki entry](https://github.com/Koellewe/logic-app/wiki/Running-and-Deployment). | ||
|
||
## More info | ||
|
||
See the [wiki](https://github.com/Koellewe/logic-app/wiki). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 30 additions & 24 deletions
54
za.org.cair.logic_app/src/test/java/za/org/cair/logic_app/tests/CommandsTest.xtend
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,46 @@ | ||
package za.org.cair.logic_app.tests | ||
|
||
import org.junit.jupiter.api.^extension.ExtendWith | ||
import org.eclipse.xtext.testing.extensions.InjectionExtension | ||
import org.eclipse.xtext.testing.InjectWith | ||
import javax.inject.Inject | ||
import org.eclipse.xtext.testing.util.ParseHelper | ||
import za.org.cair.logic_app.logicLang.Model | ||
import static org.junit.Assert.assertNotNull | ||
import org.eclipse.xtext.testing.extensions.InjectionExtension | ||
import org.junit.jupiter.api.Test | ||
//import org.eclipse.xtext.testing.validation.ValidationTestHelper | ||
//import za.org.cair.logic_app.logicLang.LogicLangPackage | ||
//import za.org.cair.logic_app.validation.LogicLangValidator | ||
import org.junit.jupiter.api.^extension.ExtendWith | ||
import za.org.cair.logic_app.validation.LogicLangValidator | ||
|
||
@ExtendWith(InjectionExtension) | ||
@InjectWith(LogicLangInjectorProvider) | ||
class CommandsTest { | ||
|
||
@Inject | ||
ParseHelper<Model> parseHelper | ||
|
||
// @Inject | ||
// ValidationTestHelper validationHelper | ||
|
||
@Test | ||
def void testNoCommands() { | ||
val result = parseHelper.parse(''' | ||
|
||
val src = ''' | ||
prop A | B | ||
prop C -> D | ||
''') | ||
assertNotNull(result) | ||
// val valres = validationHelper.validate(result) | ||
// println('valresses: ' + valres.size) | ||
// | ||
// TestingHelper.assertWarning(result, LogicLangValidator.NO_COMMANDS) | ||
|
||
// TODO: validation not working yet. Removing this test for now. | ||
''' | ||
|
||
TestingHelper.assertIssue(src, LogicLangValidator.ISSUE_NO_COMMANDS); | ||
|
||
} | ||
|
||
@Test | ||
def void satNoSolver(){ | ||
TestingHelper.assertIssue(''' | ||
prop Ayy | Bee | ||
cmd solve satisfiability | ||
''', | ||
LogicLangValidator.ISSUE_NO_SOLVER | ||
) | ||
} | ||
|
||
@Test | ||
def void satBool(){ | ||
TestingHelper.assertIssue(''' | ||
prop var1 & True | ||
cmd solve satisfiability | ||
config solver='sat4j' | ||
''', | ||
LogicLangValidator.ISSUE_SAT_BOOL | ||
) | ||
} | ||
|
||
} |
Oops, something went wrong.