Skip to content

Commit 33c141d

Browse files
authored
Merge pull request #42 from polystat/develop
Release 0.2
2 parents e9e3099 + f6cfa51 commit 33c141d

File tree

339 files changed

+18189
-8138
lines changed

Some content is hidden

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

339 files changed

+18189
-8138
lines changed

.github/badges/branches.svg

+1
Loading

.github/badges/jacoco.svg

+1
Loading

.github/workflows/gradle-build.yml

+34-5
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ jobs:
2727
with:
2828
arguments: build --info
2929

30-
- uses: gradle/gradle-build-action@v1
31-
with:
32-
arguments: test --info
30+
# - uses: gradle/gradle-build-action@v1
31+
# with:
32+
# arguments: test --info
3333

3434
gradle_ubuntu:
3535
runs-on: ubuntu-latest
@@ -53,6 +53,35 @@ jobs:
5353
with:
5454
arguments: build --info
5555

56-
- uses: gradle/gradle-build-action@v1
56+
# - uses: gradle/gradle-build-action@v1
57+
# with:
58+
# arguments: test --info
59+
60+
- name: Generate JaCoCo Badge
61+
uses: cicirello/jacoco-badge-generator@v2
62+
with:
63+
generate-branches-badge: true
64+
jacoco-csv-file: build/reports/jacoco/test/jacocoTestReport.csv
65+
66+
- name: Log coverage percentage
67+
run: |
68+
echo "coverage = ${{ steps.jacoco.outputs.coverage }}"
69+
echo "branch coverage = ${{ steps.jacoco.outputs.branches }}"
70+
71+
- name: Clean Bison directory
72+
run: |
73+
pwd
74+
rm -r ./bison-3.8
75+
76+
- name: Commit and push the badge (if it changed)
77+
uses: EndBug/add-and-commit@v7
78+
with:
79+
default_author: user_info
80+
message: 'commit badge'
81+
add: '*.svg'
82+
83+
- name: Upload JaCoCo coverage report
84+
uses: actions/upload-artifact@v2
5785
with:
58-
arguments: test --info
86+
name: jacoco-report
87+
path: target/site/jacoco/

.gitignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,7 @@ out
22
.gradle
33
.idea
44
build
5+
src/main/java/parser/JavaParser.java
56
compile_and_run_tests.bat
6-
j2eo.jar
7+
j2eo.jar
8+
output.eo

README.md

+17-15
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
<br>
77

88
[![Gradle Build](https://github.com/polystat/j2eo/actions/workflows/gradle-build.yml/badge.svg)](https://github.com/polystat/j2eo/actions/workflows/gradle-build.yml)
9+
![Coverage](.github/badges/jacoco.svg)
10+
![Branches](.github/badges/branches.svg)
911

1012
This is a translator of **Java** programming language to [EOLANG](https://www.eolang.org) programming language.
1113

@@ -32,7 +34,7 @@ cat <.java filepath> | docker run --rm -i polystat/j2eo java -jar j2eo.jar -
3234

3335
1. Make sure you have installed:
3436
- **Java 16+** (make sure command `java -version` shows 16+ version of Java in terminal if you have multiple Java version installed)
35-
- **Maven 3.3+** (be aware of [possible conflicts](https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=980467) of the latest versions of Maven and Java on some OSs)
37+
- **Maven 3.8+** (be aware of [possible conflicts](https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=980467) of the latest versions of Maven and Java on some OSs)
3638
- **Bison 3.7+** [3.7.5 recommended] (make sure the path to Bison executable is added to the `PATH` environmental variable)
3739
2. Clone the repo into your folder:
3840

@@ -106,21 +108,21 @@ bugs in our code. It is also much easier to work with abstraction layer than wit
106108
107109
## NOT covered Java features list
108110
109-
- Type Erasure
110-
- Subtyping
111-
- Conversions
112-
- Casting
113-
- Modules
114-
- Exceptions
115-
- Asserts
116-
- Throws
111+
- Type Erasure - Zouev
112+
- Subtyping - discuss with Yegor
113+
- Conversions - remove
114+
- Casting - remove
115+
- Modules
116+
- Exceptions - remove
117+
- Asserts - remove
118+
- Throws - remove
117119
- ``synchronized`` blocks
118-
- ``try``/``catch`` blocks
120+
- ``try``/``catch`` blocks - remove
119121
- ``yeild`` feature
120-
- Threads and Locks
121-
- Generics (all kinds of them)
122-
- Native methods
123-
- break and continue statements
124-
- RTTI (instanceof operator) ??????
122+
- Threads and Locks
123+
- Generics (all kinds of them) - remove
124+
- Native methods
125+
- break and continue statements - remove
126+
- RTTI (instanceof operator) ?????? - remove
125127
126128
In general, we cover **91 feature of 112** described in the Java language specification.

bin/README.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# ⚠️ NOTICE ⚠️
2+
3+
This directory contains binaries provided by GNU Bison project, thus, not implemented by us. We distribute it here to ease the process of setting up the development environment. Feel free to delete them/replace by files located in your local system.

build.gradle.kts

+21-1
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,29 @@
11
import org.apache.tools.ant.taskdefs.condition.Os
22
import java.security.MessageDigest
33
import org.gradle.jvm.tasks.Jar
4+
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
45

56

67
plugins {
78
java
89
jacoco
910
pmd
1011
checkstyle
12+
kotlin("jvm") version "1.6.0"
1113
}
1214

1315
group = "org.eolang"
1416
version = "0.1"
1517

18+
val compileKotlin: KotlinCompile by tasks
19+
compileKotlin.kotlinOptions {
20+
jvmTarget = "15"
21+
}
22+
val compileTestKotlin: KotlinCompile by tasks
23+
compileTestKotlin.kotlinOptions {
24+
jvmTarget = "15"
25+
}
26+
1627
// The Java grammar source file for Bison
1728
val javaGrammarFilePath = "src/main/resources/Java_16_Grammar.y"
1829

@@ -31,10 +42,17 @@ repositories {
3142
}
3243

3344
dependencies {
45+
// Library for command-line arguments support
3446
implementation("commons-cli:commons-cli:1.4")
47+
// Functional stuff
48+
implementation("io.arrow-kt:arrow-core:1.0.1")
49+
// Kotlin logger
50+
implementation("org.slf4j:slf4j-simple:1.7.29")
51+
implementation("io.github.microutils:kotlin-logging-jvm:2.1.0")
3552

3653
testImplementation("org.junit.jupiter:junit-jupiter-api:5.8.1")
3754
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.8.1")
55+
implementation(kotlin("stdlib-jdk8"))
3856
}
3957

4058

@@ -48,6 +66,7 @@ val fatJar = task("fatJar", type = Jar::class) {
4866
// Include dependencies
4967
from(configurations.runtimeClasspath.get().map { if (it.isDirectory) it else zipTree(it) })
5068
with(tasks["jar"] as CopySpec)
69+
duplicatesStrategy = org.gradle.api.file.DuplicatesStrategy.INCLUDE
5170
}
5271

5372
tasks {
@@ -143,6 +162,7 @@ tasks.withType<JacocoReport> {
143162
}
144163
}))
145164
}
165+
reports.csv.required.set(true)
146166
}
147167

148168
/**
@@ -200,7 +220,7 @@ fun runBison() =
200220
)
201221
}
202222
else ->
203-
throw kotlin.UnsupportedOperationException("Your OS is not yet supported. File a GitHub or issue or " +
223+
throw UnsupportedOperationException("Your OS is not yet supported. File a GitHub or issue or " +
204224
"provide a Pull Request with support for Bison execution for your OS.")
205225
}
206226
} catch (e: Exception) {

src/main/java/eotree/EOAnonExpr.java

-12
This file was deleted.

src/main/java/eotree/EOAttribute.java

-26
This file was deleted.

src/main/java/eotree/EOAttributes.java

-21
This file was deleted.

src/main/java/eotree/EOBnd.java

-9
This file was deleted.

src/main/java/eotree/EOBnd.kt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
package eotree
2+
3+
abstract class EOBnd(var expr: EOExpr) : EONode()

src/main/java/eotree/EOBndExpr.java

-28
This file was deleted.

src/main/java/eotree/EOBndExpr.kt

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package eotree
2+
3+
import arrow.core.prependTo
4+
import arrow.core.tail
5+
6+
class EOBndExpr(expr: EOExpr, var bndName: String) : EOBnd(expr) {
7+
override fun generateEO(indent: Int): String {
8+
val lines = expr.generateEO(indent).split("\n")
9+
10+
// Append attribute name to the first line
11+
return lines
12+
.first()
13+
.let { line -> "$line > $bndName" }
14+
.prependTo(lines.tail())
15+
.joinToString("\n")
16+
}
17+
18+
override fun toString(): String = "[expr] > $bndName"
19+
}

src/main/java/eotree/EOBndName.java

-14
This file was deleted.

src/main/java/eotree/EOComment.java

-20
This file was deleted.

src/main/java/eotree/EOComment.kt

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package eotree
2+
3+
/**
4+
* EBNF representation:
5+
* `
6+
* '#' ANY EOL
7+
` *
8+
*/
9+
class EOComment(var comment: String) : EONode() {
10+
override fun generateEO(indent: Int): String =
11+
"# $comment"
12+
13+
override fun toString(): String =
14+
"# $comment"
15+
}

0 commit comments

Comments
 (0)