Skip to content

Commit

Permalink
Merge pull request #42 from polystat/develop
Browse files Browse the repository at this point in the history
Release 0.2
  • Loading branch information
IamMaxim authored Dec 30, 2021
2 parents e9e3099 + f6cfa51 commit 33c141d
Show file tree
Hide file tree
Showing 339 changed files with 18,189 additions and 8,138 deletions.
1 change: 1 addition & 0 deletions .github/badges/branches.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions .github/badges/jacoco.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
39 changes: 34 additions & 5 deletions .github/workflows/gradle-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ jobs:
with:
arguments: build --info

- uses: gradle/gradle-build-action@v1
with:
arguments: test --info
# - uses: gradle/gradle-build-action@v1
# with:
# arguments: test --info

gradle_ubuntu:
runs-on: ubuntu-latest
Expand All @@ -53,6 +53,35 @@ jobs:
with:
arguments: build --info

- uses: gradle/gradle-build-action@v1
# - uses: gradle/gradle-build-action@v1
# with:
# arguments: test --info

- name: Generate JaCoCo Badge
uses: cicirello/jacoco-badge-generator@v2
with:
generate-branches-badge: true
jacoco-csv-file: build/reports/jacoco/test/jacocoTestReport.csv

- name: Log coverage percentage
run: |
echo "coverage = ${{ steps.jacoco.outputs.coverage }}"
echo "branch coverage = ${{ steps.jacoco.outputs.branches }}"
- name: Clean Bison directory
run: |
pwd
rm -r ./bison-3.8
- name: Commit and push the badge (if it changed)
uses: EndBug/add-and-commit@v7
with:
default_author: user_info
message: 'commit badge'
add: '*.svg'

- name: Upload JaCoCo coverage report
uses: actions/upload-artifact@v2
with:
arguments: test --info
name: jacoco-report
path: target/site/jacoco/
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@ out
.gradle
.idea
build
src/main/java/parser/JavaParser.java
compile_and_run_tests.bat
j2eo.jar
j2eo.jar
output.eo
32 changes: 17 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
<br>

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

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

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

1. Make sure you have installed:
- **Java 16+** (make sure command `java -version` shows 16+ version of Java in terminal if you have multiple Java version installed)
- **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)
- **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)
- **Bison 3.7+** [3.7.5 recommended] (make sure the path to Bison executable is added to the `PATH` environmental variable)
2. Clone the repo into your folder:

Expand Down Expand Up @@ -106,21 +108,21 @@ bugs in our code. It is also much easier to work with abstraction layer than wit
## NOT covered Java features list
- Type Erasure
- Subtyping
- Conversions
- Casting
- Modules
- Exceptions
- Asserts
- Throws
- Type Erasure - Zouev
- Subtyping - discuss with Yegor
- Conversions - remove
- Casting - remove
- Modules
- Exceptions - remove
- Asserts - remove
- Throws - remove
- ``synchronized`` blocks
- ``try``/``catch`` blocks
- ``try``/``catch`` blocks - remove
- ``yeild`` feature
- Threads and Locks
- Generics (all kinds of them)
- Native methods
- break and continue statements
- RTTI (instanceof operator) ??????
- Threads and Locks
- Generics (all kinds of them) - remove
- Native methods
- break and continue statements - remove
- RTTI (instanceof operator) ?????? - remove
In general, we cover **91 feature of 112** described in the Java language specification.
3 changes: 3 additions & 0 deletions bin/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# ⚠️ NOTICE ⚠️

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.
22 changes: 21 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,18 +1,29 @@
import org.apache.tools.ant.taskdefs.condition.Os
import java.security.MessageDigest
import org.gradle.jvm.tasks.Jar
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile


plugins {
java
jacoco
pmd
checkstyle
kotlin("jvm") version "1.6.0"
}

group = "org.eolang"
version = "0.1"

val compileKotlin: KotlinCompile by tasks
compileKotlin.kotlinOptions {
jvmTarget = "15"
}
val compileTestKotlin: KotlinCompile by tasks
compileTestKotlin.kotlinOptions {
jvmTarget = "15"
}

// The Java grammar source file for Bison
val javaGrammarFilePath = "src/main/resources/Java_16_Grammar.y"

Expand All @@ -31,10 +42,17 @@ repositories {
}

dependencies {
// Library for command-line arguments support
implementation("commons-cli:commons-cli:1.4")
// Functional stuff
implementation("io.arrow-kt:arrow-core:1.0.1")
// Kotlin logger
implementation("org.slf4j:slf4j-simple:1.7.29")
implementation("io.github.microutils:kotlin-logging-jvm:2.1.0")

testImplementation("org.junit.jupiter:junit-jupiter-api:5.8.1")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.8.1")
implementation(kotlin("stdlib-jdk8"))
}


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

tasks {
Expand Down Expand Up @@ -143,6 +162,7 @@ tasks.withType<JacocoReport> {
}
}))
}
reports.csv.required.set(true)
}

/**
Expand Down Expand Up @@ -200,7 +220,7 @@ fun runBison() =
)
}
else ->
throw kotlin.UnsupportedOperationException("Your OS is not yet supported. File a GitHub or issue or " +
throw UnsupportedOperationException("Your OS is not yet supported. File a GitHub or issue or " +
"provide a Pull Request with support for Bison execution for your OS.")
}
} catch (e: Exception) {
Expand Down
12 changes: 0 additions & 12 deletions src/main/java/eotree/EOAnonExpr.java

This file was deleted.

26 changes: 0 additions & 26 deletions src/main/java/eotree/EOAttribute.java

This file was deleted.

21 changes: 0 additions & 21 deletions src/main/java/eotree/EOAttributes.java

This file was deleted.

9 changes: 0 additions & 9 deletions src/main/java/eotree/EOBnd.java

This file was deleted.

3 changes: 3 additions & 0 deletions src/main/java/eotree/EOBnd.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package eotree

abstract class EOBnd(var expr: EOExpr) : EONode()
28 changes: 0 additions & 28 deletions src/main/java/eotree/EOBndExpr.java

This file was deleted.

19 changes: 19 additions & 0 deletions src/main/java/eotree/EOBndExpr.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package eotree

import arrow.core.prependTo
import arrow.core.tail

class EOBndExpr(expr: EOExpr, var bndName: String) : EOBnd(expr) {
override fun generateEO(indent: Int): String {
val lines = expr.generateEO(indent).split("\n")

// Append attribute name to the first line
return lines
.first()
.let { line -> "$line > $bndName" }
.prependTo(lines.tail())
.joinToString("\n")
}

override fun toString(): String = "[expr] > $bndName"
}
14 changes: 0 additions & 14 deletions src/main/java/eotree/EOBndName.java

This file was deleted.

20 changes: 0 additions & 20 deletions src/main/java/eotree/EOComment.java

This file was deleted.

15 changes: 15 additions & 0 deletions src/main/java/eotree/EOComment.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package eotree

/**
* EBNF representation:
* `
* '#' ANY EOL
` *
*/
class EOComment(var comment: String) : EONode() {
override fun generateEO(indent: Int): String =
"# $comment"

override fun toString(): String =
"# $comment"
}
Loading

1 comment on commit 33c141d

@0pdd
Copy link
Member

@0pdd 0pdd commented on 33c141d Dec 30, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't able to retrieve PDD puzzles from the code base and submit them to GitHub. If you think that it's a bug on our side, please submit it to yegor256/0pdd:

set -x && set -e && set -o pipefail && cd /tmp/0pdd20211201-12-1eyu7d6/polystat/j2eo && pdd -v -f /tmp/20211230-16403-wkm39m [1]: + set -e + set -o pipefail + cd /tmp/0pdd20211201-12-1eyu7d6/polystat/j2eo + pdd -v -f /tmp/20211230-16403-wkm39m My version is 0.20.6 Ruby version is 2.6.0 at...

Please, copy and paste this stack trace to GitHub:

UserError
set -x && set -e && set -o pipefail && cd /tmp/0pdd20211201-12-1eyu7d6/polystat/j2eo && pdd -v -f /tmp/20211230-16403-wkm39m [1]:
+ set -e
+ set -o pipefail
+ cd /tmp/0pdd20211201-12-1eyu7d6/polystat/j2eo
+ pdd -v -f /tmp/20211230-16403-wkm39m

My version is 0.20.6
Ruby version is 2.6.0 at x86_64-linux
Reading /tmp/0pdd20211201-12-1eyu7d6/polystat/j2eo
1130 file(s) found, 58 excluded
/tmp/0pdd20211201-12-1eyu7d6/polystat/j2eo/bin/custom_build_rules/docs/Verbosity.png is a binary file (29722 bytes)
/tmp/0pdd20211201-12-1eyu7d6/polystat/j2eo/bin/custom_build_rules/docs/FlexProperties.png is a binary file (26767 bytes)
/tmp/0pdd20211201-12-1eyu7d6/polystat/j2eo/bin/custom_build_rules/docs/3.png is a binary file (7316 bytes)
/tmp/0pdd20211201-12-1eyu7d6/polystat/j2eo/bin/custom_build_rules/docs/6.png is a binary file (15611 bytes)
/tmp/0pdd20211201-12-1eyu7d6/polystat/j2eo/bin/custom_build_rules/docs/BisonProperties.png is a binary file (27186 bytes)
/tmp/0pdd20211201-12-1eyu7d6/polystat/j2eo/bin/custom_build_rules/docs/2.png is a binary file (11445 bytes)
/tmp/0pdd20211201-12-1eyu7d6/polystat/j2eo/bin/custom_build_rules/docs/Flex_debuging.png is a binary file (27219 bytes)
/tmp/0pdd20211201-12-1eyu7d6/polystat/j2eo/bin/custom_build_rules/docs/Properties.png is a binary file (31446 bytes)
/tmp/0pdd20211201-12-1eyu7d6/polystat/j2eo/bin/custom_build_rules/docs/4.png is a binary file (12213 bytes)
/tmp/0pdd20211201-12-1eyu7d6/polystat/j2eo/bin/custom_build_rules/docs/1.png is a binary file (31654 bytes)
/tmp/0pdd20211201-12-1eyu7d6/polystat/j2eo/bin/custom_build_rules/docs/5.png is a binary file (11534 bytes)
/tmp/0pdd20211201-12-1eyu7d6/polystat/j2eo/bin/win_bison.exe is a binary file (665600 bytes)
/tmp/0pdd20211201-12-1eyu7d6/polystat/j2eo/bin/win_flex.exe is a binary file (569344 bytes)
/tmp/0pdd20211201-12-1eyu7d6/polystat/j2eo/bin/bison_mac is a binary file (487680 bytes)
/tmp/0pdd20211201-12-1eyu7d6/polystat/j2eo/gradle/wrapper/gradle-wrapper.jar is a binary file (59203 bytes)
Reading bin/README.md...
Reading bin/changelog.md...
Reading bin/custom_build_rules/README.md...
Reading bin/custom_build_rules/win_flex_only/win_flex_custom_build.targets...
Reading bin/custom_build_rules/win_flex_only/win_flex_custom_build.props...
Reading bin/custom_build_rules/win_flex_only/win_flex_custom_build.xml...
Reading bin/custom_build_rules/win_bison_only/win_bison_custom_build.xml...
Reading bin/custom_build_rules/win_bison_only/win_bison_custom_build.props...
Reading bin/custom_build_rules/win_bison_only/win_bison_custom_build.targets...
Reading bin/custom_build_rules/win_flex_bison/win_flex_bison_custom_build.props...
Reading bin/custom_build_rules/win_flex_bison/win_flex_bison_custom_build.targets...
Reading bin/custom_build_rules/win_flex_bison/win_flex_bison_custom_build.xml...
Reading bin/data/local.mk...
Reading bin/data/README.md...
Reading bin/data/bison-default.css...
Reading bin/data/m4sugar/m4sugar.m4...
Reading bin/data/m4sugar/foreach.m4...
Reading bin/data/skeletons/java-skel.m4...
Reading bin/data/skeletons/location.cc...
Reading bin/data/skeletons/lalr1.java...
Reading bin/data/skeletons/c++.m4...
Reading bin/data/skeletons/traceon.m4...
Reading bin/data/skeletons/glr.cc...
Reading bin/data/skeletons/glr.c...
Reading bin/data/skeletons/c++-skel.m4...
Reading bin/data/skeletons/d.m4...
ERROR: bin/data/skeletons/d.m4; puzzle at line #298; TODO found, but puzzle can't be parsed, most probably because TODO is not followed by a puzzle marker, as this page explains: https://github.com/yegor256/pdd#how-to-format
If you can't understand the cause of this issue or you don't know how to fix it, please submit a GitHub issue, we will try to help you: https://github.com/yegor256/pdd/issues. This tool is still in its beta version and we will appreciate your feedback. Here is where you can find more documentation: https://github.com/yegor256/pdd/blob/master/README.md.
Exit code is 1

/app/objects/git_repo.rb:66:in `rescue in block in xml'
/app/objects/git_repo.rb:63:in `block in xml'
/app/vendor/ruby-2.6.0/lib/ruby/2.6.0/tempfile.rb:295:in `open'
/app/objects/git_repo.rb:62:in `xml'
/app/objects/puzzles.rb:36:in `deploy'
/app/objects/job.rb:38:in `proceed'
/app/objects/job_starred.rb:33:in `proceed'
/app/objects/job_recorded.rb:32:in `proceed'
/app/objects/job_emailed.rb:35:in `proceed'
/app/objects/job_commiterrors.rb:36:in `proceed'
/app/objects/job_detached.rb:48:in `exclusive'
/app/objects/job_detached.rb:36:in `block in proceed'
/app/objects/job_detached.rb:36:in `fork'
/app/objects/job_detached.rb:36:in `proceed'
/app/0pdd.rb:357:in `block in <top (required)>'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1675:in `call'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1675:in `block in compile!'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1013:in `block (3 levels) in route!'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1032:in `route_eval'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1013:in `block (2 levels) in route!'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1061:in `block in process_route'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1059:in `catch'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1059:in `process_route'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1011:in `block in route!'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1008:in `each'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1008:in `route!'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1129:in `block in dispatch!'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1101:in `block in invoke'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1101:in `catch'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1101:in `invoke'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1124:in `dispatch!'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:939:in `block in call!'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1101:in `block in invoke'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1101:in `catch'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1101:in `invoke'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:939:in `call!'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:929:in `call'
/app/vendor/bundle/ruby/2.6.0/gems/rack-protection-2.1.0/lib/rack/protection/xss_header.rb:18:in `call'
/app/vendor/bundle/ruby/2.6.0/gems/rack-protection-2.1.0/lib/rack/protection/path_traversal.rb:16:in `call'
/app/vendor/bundle/ruby/2.6.0/gems/rack-protection-2.1.0/lib/rack/protection/json_csrf.rb:26:in `call'
/app/vendor/bundle/ruby/2.6.0/gems/rack-protection-2.1.0/lib/rack/protection/base.rb:50:in `call'
/app/vendor/bundle/ruby/2.6.0/gems/rack-protection-2.1.0/lib/rack/protection/base.rb:50:in `call'
/app/vendor/bundle/ruby/2.6.0/gems/rack-protection-2.1.0/lib/rack/protection/frame_options.rb:31:in `call'
/app/vendor/bundle/ruby/2.6.0/gems/rack-2.2.3/lib/rack/logger.rb:17:in `call'
/app/vendor/bundle/ruby/2.6.0/gems/rack-2.2.3/lib/rack/common_logger.rb:38:in `call'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:253:in `call'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:246:in `call'
/app/vendor/bundle/ruby/2.6.0/gems/rack-2.2.3/lib/rack/head.rb:12:in `call'
/app/vendor/bundle/ruby/2.6.0/gems/rack-2.2.3/lib/rack/method_override.rb:24:in `call'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:216:in `call'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1991:in `call'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1542:in `block in call'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1769:in `synchronize'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1542:in `call'
/app/vendor/bundle/ruby/2.6.0/gems/rack-2.2.3/lib/rack/handler/webrick.rb:95:in `service'
/app/vendor/ruby-2.6.0/lib/ruby/2.6.0/webrick/httpserver.rb:140:in `service'
/app/vendor/ruby-2.6.0/lib/ruby/2.6.0/webrick/httpserver.rb:96:in `run'
/app/vendor/ruby-2.6.0/lib/ruby/2.6.0/webrick/server.rb:307:in `block in start_thread'

Please sign in to comment.