Skip to content

Commit d75c4fa

Browse files
authored
Merge pull request #13 from UniVE-SSV/analysis-framework
Analysis framework, type inference, IMP frontend, output serialization
2 parents 35b1944 + 1030531 commit d75c4fa

File tree

155 files changed

+13152
-381
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

155 files changed

+13152
-381
lines changed

.github/workflows/gradle.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ name: Gradle Build
66
on:
77
push:
88
branches: [ '**' ]
9-
pull_request:
10-
branches: [ master ]
119

1210
jobs:
1311
build:

lisa/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,6 @@ local.properties
4242

4343
# UML diagrams
4444
diagrams/
45+
46+
# tests
47+
test-outputs/

lisa/antlr.gradle

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
generateTestGrammarSource {
2+
maxHeapSize = "64m"
3+
arguments += ["-visitor", "-no-listener"]
4+
5+
doLast {
6+
copy {
7+
from 'build/generated-src/antlr/test/'
8+
include '*.*'
9+
into 'build/generated-src/antlr/test/it/unive/lisa/test/antlr'
10+
}
11+
project.delete fileTree('build/generated-src/antlr/test').include('*.*')
12+
}
13+
}

lisa/build.gradle

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ plugins {
2424
// magic for getting eclipse to work with gradle
2525
id 'eclipse'
2626

27+
// antlr plugin for the generation of the IMP parser
28+
id 'antlr'
29+
2730
// automatic generation of plantuml files from the source code
2831
// for visualizing them: https://www.planttext.com/
2932
id 'com.github.roroche.plantuml' version '1.0.2'
@@ -77,4 +80,5 @@ version = '0.1a1'
7780
apply from: 'dependencies.gradle'
7881
apply from: 'java.gradle'
7982
apply from: 'code-style.gradle'
80-
apply from: 'doc-extra.gradle'
83+
apply from: 'doc-extra.gradle'
84+
apply from: 'antlr.gradle'

lisa/code-style.gradle

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,9 @@ checkstyleTest {
1919
xml.enabled false
2020
html.enabled false
2121
}
22-
// no test code require javadoc for now
23-
exclude '**/*.java'
24-
// when tests that require javadoc are added,
25-
// delete the exclude clause above and add them
26-
// with: include 'it/unive/lisa/test/package_to_include/**/*.java'
22+
23+
// only included files will be checked
24+
include 'it/unive/lisa/test/imp/**/*.java'
2725
}
2826

2927
task checkstyleErrorMessage {

lisa/dependencies.gradle

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,25 @@ repositories {
44
}
55

66
dependencies {
7+
// utils
78
api 'org.apache.commons:commons-lang3:3.9'
89
api 'org.apache.commons:commons-text:1.9'
9-
api 'org.apache.logging.log4j:log4j-api:2.13.0'
10+
api 'commons-collections:commons-collections:3.2.2'
1011

12+
// logging
13+
api 'org.apache.logging.log4j:log4j-api:2.13.0'
1114
runtimeOnly 'org.apache.logging.log4j:log4j-core:2.13.0'
15+
runtimeOnly 'org.apache.logging.log4j:log4j-slf4j-impl:2.13.0'
16+
17+
// json serialization/deserialization
18+
api 'com.fasterxml.jackson.core:jackson-databind:2.11.0'
19+
20+
// dot file manipulation
21+
api 'org.graphstream:gs-core:2.0'
22+
23+
// parser generation
24+
antlr 'org.antlr:antlr4:4.8-1'
1225

26+
// testing
1327
testImplementation 'junit:junit:4.12'
1428
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
class expressions {
2+
assignment() {
3+
i = 5;
4+
x = "s";
5+
}
6+
7+
_throw() {
8+
throw x;
9+
throw i;
10+
}
11+
12+
_return() {
13+
return i;
14+
return x;
15+
}
16+
17+
call() {
18+
this.test(5);
19+
this.test(i, 5);
20+
}
21+
22+
nestedCall() {
23+
this.test(5, this.test(i, 5));
24+
this.test(x, this.test(i));
25+
return this.test(i);
26+
throw this.test(i);
27+
x = this.test(i);
28+
}
29+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"warnings" : [ {
3+
"message" : "['imp-testcases/syntactic/expressions.imp':13:9] on 'untyped _return()': [EXPRESSION] Found variable i"
4+
}, {
5+
"message" : "['imp-testcases/syntactic/expressions.imp':19:12] on 'untyped call()': [EXPRESSION] Found variable i"
6+
}, {
7+
"message" : "['imp-testcases/syntactic/expressions.imp':23:25] on 'untyped nestedCall()': [EXPRESSION] Found variable i"
8+
}, {
9+
"message" : "['imp-testcases/syntactic/expressions.imp':24:25] on 'untyped nestedCall()': [EXPRESSION] Found variable i"
10+
}, {
11+
"message" : "['imp-testcases/syntactic/expressions.imp':25:19] on 'untyped nestedCall()': [EXPRESSION] Found variable i"
12+
}, {
13+
"message" : "['imp-testcases/syntactic/expressions.imp':26:18] on 'untyped nestedCall()': [EXPRESSION] Found variable i"
14+
}, {
15+
"message" : "['imp-testcases/syntactic/expressions.imp':27:16] on 'untyped nestedCall()': [EXPRESSION] Found variable i"
16+
}, {
17+
"message" : "['imp-testcases/syntactic/expressions.imp':3:2] on 'untyped assignment()': [EXPRESSION] Found variable i"
18+
}, {
19+
"message" : "['imp-testcases/syntactic/expressions.imp':9:8] on 'untyped _throw()': [EXPRESSION] Found variable i"
20+
} ],
21+
"files" : [ ]
22+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
class typing {
2+
test1() {
3+
i = 5;
4+
x = "s";
5+
}
6+
7+
test2(i) {
8+
if (i > 5)
9+
x = 10;
10+
else
11+
x = "s";
12+
return x;
13+
}
14+
15+
test3(i) {
16+
while (i > 5)
17+
i = i + 1;
18+
return i;
19+
}
20+
21+
test4(i) {
22+
for (;i > 5; i = i + 1)
23+
x = "s";
24+
return x;
25+
}
26+
27+
test5(i) {
28+
for (;i > 5; i = i + 1)
29+
if (i % 2 == 0)
30+
x = "s";
31+
else
32+
x = "p";
33+
return x;
34+
}
35+
36+
test6(i) {
37+
if (i % 2 == 0)
38+
for (;i > 5; i = i + 1)
39+
x = "p";
40+
return x;
41+
}
42+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"warnings" : [ ],
3+
"files" : [ "typing___untyped_test1().dot", "typing___untyped_test2(untyped_i).dot", "typing___untyped_test3(untyped_i).dot", "typing___untyped_test4(untyped_i).dot", "typing___untyped_test5(untyped_i).dot", "typing___untyped_test6(untyped_i).dot" ]
4+
}

0 commit comments

Comments
 (0)