Small changes for java2nrx

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

Small changes for java2nrx

Jason Martin
Write TRUE or FALSE in a NetRexx way 

Update DumpVisitor.java

public void visit(BooleanLiteralExpr n, Object arg) {
if (n.getValue()) {
printer.print("1");
} else {
printer.print("0");
}
}


Update java2nrx.java

System.out.println("java2nrx, the translator translator, version 1.0.3");


Update build.xml

<attribute name="Implementation-Version" value="1.0.3" />


Added Note:

When I use, I always place java2nrx.sh and the Jar file in my NetRexx/bin so it's always available to me.

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Re: Small changes for java2nrx

ThSITC
*Maybe* NetRexx vs. 4.0 could support *TRUE* and *FALSE* as Synonyms to
boolean 1 *and* boolean 0 *the other way around* ?

Thomas Schneider.
======================================================================

Am 02.03.2016 um 21:16 schrieb Jason Martin:
Write TRUE or FALSE in a NetRexx way 

Update DumpVisitor.java

public void visit(BooleanLiteralExpr n, Object arg) {
if (n.getValue()) {
printer.print("1");
} else {
printer.print("0");
}
}


Update java2nrx.java

System.out.println("java2nrx, the translator translator, version 1.0.3");


Update build.xml

<attribute name="Implementation-Version" value="1.0.3" />


Added Note:

When I use, I always place java2nrx.sh and the Jar file in my NetRexx/bin so it's always available to me.


_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/



_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Thomas Schneider, Vienna, Austria (Europe) :-)

www.thsitc.com
www.db-123.com
Reply | Threaded
Open this post in threaded view
|

Re: Small changes for java2nrx

Jason Martin
In reply to this post by Jason Martin
Also change throw to signal,

public void visit(ThrowStmt n, Object arg) {
printer.print("signal ");
n.getExpr().accept(this, arg);
// printer.print(";");
}



On Wed, Mar 2, 2016 at 3:16 PM, Jason Martin <[hidden email]> wrote:
Write TRUE or FALSE in a NetRexx way 

Update DumpVisitor.java

public void visit(BooleanLiteralExpr n, Object arg) {
if (n.getValue()) {
printer.print("1");
} else {
printer.print("0");
}
}


Update java2nrx.java

System.out.println("java2nrx, the translator translator, version 1.0.3");


Update build.xml

<attribute name="Implementation-Version" value="1.0.3" />


Added Note:

When I use, I always place java2nrx.sh and the Jar file in my NetRexx/bin so it's always available to me.


_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Re: Small changes for java2nrx

Jason Martin
In reply to this post by Jason Martin
Needs Bug Fix for method declarations with duplicate modifiers

Example from Android:

From file sdk/sources/android-16/junit/runner/TestSuiteLoader.java:

method load( suiteClassName=String ) abstract abstract  returns Class signals ClassNotFoundException


On Wed, Mar 2, 2016 at 3:16 PM, Jason Martin <[hidden email]> wrote:
Write TRUE or FALSE in a NetRexx way 

Update DumpVisitor.java

public void visit(BooleanLiteralExpr n, Object arg) {
if (n.getValue()) {
printer.print("1");
} else {
printer.print("0");
}
}


Update java2nrx.java

System.out.println("java2nrx, the translator translator, version 1.0.3");


Update build.xml

<attribute name="Implementation-Version" value="1.0.3" />


Added Note:

When I use, I always place java2nrx.sh and the Jar file in my NetRexx/bin so it's always available to me.


_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Re: Small changes for java2nrx

Jason Martin
In reply to this post by Jason Martin
In my local copy, I also added:


private String literal_to_chop;


public void visit(DoubleLiteralExpr n, Object arg) {
literal_to_chop = (n.getValue()).toString();
if ((literal_to_chop.substring(literal_to_chop.length() - 1)).equals("d")) {
printer.print(literal_to_chop.substring(0, literal_to_chop.length()-1));
} else if ((literal_to_chop.substring(literal_to_chop.length() - 1)).equals("f")) {
printer.print(literal_to_chop.substring(0, literal_to_chop.length()-1));
} else {
printer.print(n.getValue());
}
literal_to_chop = "";
}


public void visit(LongLiteralExpr n, Object arg) {
literal_to_chop = (n.getValue()).toString();
if ((literal_to_chop.substring(literal_to_chop.length() - 1)).equals("L")) {
printer.print(literal_to_chop.substring(0, literal_to_chop.length()-1));
} else {
printer.print(n.getValue());
}
literal_to_chop = "";
}



On Wed, Mar 2, 2016 at 3:16 PM, Jason Martin <[hidden email]> wrote:
Write TRUE or FALSE in a NetRexx way 

Update DumpVisitor.java

public void visit(BooleanLiteralExpr n, Object arg) {
if (n.getValue()) {
printer.print("1");
} else {
printer.print("0");
}
}


Update java2nrx.java

System.out.println("java2nrx, the translator translator, version 1.0.3");


Update build.xml

<attribute name="Implementation-Version" value="1.0.3" />


Added Note:

When I use, I always place java2nrx.sh and the Jar file in my NetRexx/bin so it's always available to me.


_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Re: Small changes for java2nrx

Jason Martin
In reply to this post by Jason Martin
Change all "end to <quote><space>end in DumpVisitor.java

No end with be joined to previous token

Not pretty printed but NetRexx Compiler will parse


On Wed, Mar 2, 2016 at 3:16 PM, Jason Martin <[hidden email]> wrote:
Write TRUE or FALSE in a NetRexx way 

Update DumpVisitor.java

public void visit(BooleanLiteralExpr n, Object arg) {
if (n.getValue()) {
printer.print("1");
} else {
printer.print("0");
}
}


Update java2nrx.java

System.out.println("java2nrx, the translator translator, version 1.0.3");


Update build.xml

<attribute name="Implementation-Version" value="1.0.3" />


Added Note:

When I use, I always place java2nrx.sh and the Jar file in my NetRexx/bin so it's always available to me.


_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Re: Small changes for java2nrx

Marc Remes-2
Jason,

can you point to some source code that is wrongly translated? I have not seen 'joined end' statements.

BTW, I'm updating the code with your previous feedback. Thanks


On 03/05/2016 04:56 PM, Jason Martin wrote:

> Change all "end to <quote><space>end in DumpVisitor.java
>
> No end with be joined to previous token
>
> Not pretty printed but NetRexx Compiler will parse
>
>
> On Wed, Mar 2, 2016 at 3:16 PM, Jason Martin <[hidden email] <mailto:[hidden email]>> wrote:
>
>     Write TRUE or FALSE in a NetRexx way
>
>     Update DumpVisitor.java
>
>     public void visit(BooleanLiteralExpr n, Object arg) {
>     if (n.getValue()) {
>     printer.print("1");
>     } else {
>     printer.print("0");
>     }
>     }
>
>
>     Update java2nrx.java
>
>     System.out.println("java2nrx, the translator translator, version 1.0.3");
>
>
>     Update build.xml
>
>     <attribute name="Implementation-Version" value="1.0.3" />
>
>
>     Added Note:
>
>     When I use, I always place java2nrx.sh and the Jar file in my NetRexx/bin so it's always available to me.
>
>
>
>
> _______________________________________________
> Ibm-netrexx mailing list
> [hidden email]
> Online Archive : http://ibm-netrexx.215625.n3.nabble.com/
>


--

Marc

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Re: Small changes for java2nrx

Marc Remes-2
In reply to this post by Jason Martin
Are duplicate modifiers allowed? Note, I'm using the java 1.5 AST code, apparently that does not accept these..


On 03/04/2016 09:41 PM, Jason Martin wrote:

> Needs Bug Fix for method declarations with duplicate modifiers
>
> Example from Android:
>
>  From file sdk/sources/android-16/junit/runner/TestSuiteLoader.java:
>
> method load( suiteClassName=String ) abstract abstract  returns Class signals ClassNotFoundException
>
>
> On Wed, Mar 2, 2016 at 3:16 PM, Jason Martin <[hidden email] <mailto:[hidden email]>> wrote:
>
>     Write TRUE or FALSE in a NetRexx way
>
>     Update DumpVisitor.java
>
>     public void visit(BooleanLiteralExpr n, Object arg) {
>     if (n.getValue()) {
>     printer.print("1");
>     } else {
>     printer.print("0");
>     }
>     }
>
>
>     Update java2nrx.java
>
>     System.out.println("java2nrx, the translator translator, version 1.0.3");
>
>
>     Update build.xml
>
>     <attribute name="Implementation-Version" value="1.0.3" />
>
>
>     Added Note:
>
>     When I use, I always place java2nrx.sh and the Jar file in my NetRexx/bin so it's always available to me.
>
>
>
>
> _______________________________________________
> Ibm-netrexx mailing list
> [hidden email]
> Online Archive : http://ibm-netrexx.215625.n3.nabble.com/
>


--

Marc

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Re: Small changes for java2nrx

Jason Martin
In reply to this post by Jason Martin
dupe modifiers? From the NetRexx docs. "No"

I am using API 16 platform sources that you install from the Android SDK Manager

There are 6721 java files there that takes my machine 4 hours to process (2 fail to convert)

It makes a good Test Case for java2nrx. (Code was still at Java 6)

It would not build even if they all converted perfectly.

grep -c -e 1end MY_BUILD.LOG returns 37 cases of just 1end most are occuring after return a number

Adding <quote><space>end got me to about 760 clean buildable nrx files

Here are some files with problems

CASES without RETURN

LoadingTestCollector.java
BaseTestRunner.java
TestRunner.java
TestWebServer.java
Selection.java
LinkMovementMethod.java
LoginFilter.java

CASE without RETURN

NetRexx portable processor 3.04 GA build 4-20150630-1657
Copyright (c) RexxLA, 2011,2015.   All rights reserved.
Parts Copyright (c) IBM Corporation, 1995,2008.
Program HTML5VideoViewProxy.nrx
 188 +++             VideoPlayer.isVideoSelfEnded = 1end
     +++                                            ^^^
     +++ Error: Incorrect syntax for a number
Compilation of 'HTML5VideoViewProxy.nrx' failed [one error]


On Wed, Mar 2, 2016 at 3:16 PM, Jason Martin <[hidden email]> wrote:
Write TRUE or FALSE in a NetRexx way 

Update DumpVisitor.java

public void visit(BooleanLiteralExpr n, Object arg) {
if (n.getValue()) {
printer.print("1");
} else {
printer.print("0");
}
}


Update java2nrx.java

System.out.println("java2nrx, the translator translator, version 1.0.3");


Update build.xml

<attribute name="Implementation-Version" value="1.0.3" />


Added Note:

When I use, I always place java2nrx.sh and the Jar file in my NetRexx/bin so it's always available to me.


_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Re: Small changes for java2nrx

Jason Martin
In reply to this post by Jason Martin
First CASES without RETURN should read CASES with RETURN

Here's a Summary of Errors I am left with : RED or Doubled quoted should probably(up to you) be caught by java2nrx

1507 The method '' cannot be found in class '' or a superclass
1096 Name has already been used as the name of a property
743 Unknown variable
705 ""Unexpected character found in source: ':' (hexadecimal encoding: 003A)""
700 PROPERTIES may not be used within a method
663 ""Properties in dependent classes may not be CONSTANT or STATIC""
660 Result of this expression cannot be just a type
651 ""Not allowed in an interface class (all properties are PUBLIC and CONSTANT)""
585 Cannot assign a new value to a constant
475 A constant must be assigned a value not just a type
351 Argument name has already been used as the name of a property
334 The property '' cannot be found in class ' or a superclass
281 Variable or type expected
250 Keyword symbol expected
191 shared method cannot override the inheritable method
187 Repeated plus is not allowed
181 Cannot convert value of type
174 The constructor '' cannot be found in class
159 Clause cannot be reached
155 Not expected outside method
148 Cannot convert type 'netrexx.lang.Rexx[]' to
128 ""Only one modifier keyword is allowed""
108 ELSE clause found when not expected
92 The class '' cannot be found
76 Exception is not signalled in the body of the DO construct
76 Variable is not an array
75 ""DO clause requires a matching END""
64 Cannot convert a type to a type
63 Class reference is ambiguous (more than one class matches '')
50 Class must be an interface class to extend an interface class
49 The class '' is not a dependent class so it cannot be constructed in the context of a parent object
49 Type expected
42 An equals sign or comma is expected after an argument name
42 LEAVE without label is not inside LOOP construct
41 The external name '' is a Java reserved word so would not be usable from Java programs
39 A default constructor call 'super()' is needed but the immediate superclass has no accessible matching constructor
32 Cannot have a constant on the left of an assignment
32 Unexpected token in expression
27 Junk found after the method call in a method call instruction
26 Expression expected
26 Left-hand operand cannot be just a type
23 Partial term is primitive type 'int' which cannot have methods or properties
22 Incorrect syntax for a number
22 Variable initialization needs a type or value not just 'null'
21 End of clause expected (junk on end ignored)
21 Unexpected clause in a SELECT construct
20 More than one method matches the name and signature
19 Cannot refer to a non-static property before value has been constructed
18 Duplicate explicit IMPORT
17 Class '' is not a dependent class so cannot use 'parent'
17 Property names must be simple symbols
17 RETURN with a value of type 'boolean' required
16 The value of the property '' is undefined perhaps because of a forward reference
15 Symbol is not a known keyword
14 Program contains no classes
12 Parent class cannot be constructed so this class cannot be dependent
12 Unmatched block comment start
9 Arguments to the right of optional arguments must also be optional (have values specified)
8 Abstract methods must be empty
8 Methods in dependent classes may not be CONSTANT or STATIC
8 Unexpected use of local variable
7 Unexpected use of property name
6 A type is expected not a variable name
6 Previous class '' is not the parent of this minor class
5 Exception type expected
5 Unexpected comma '' in expression
4 Class is not abstract yet it does not implement method
4 Method signature duplicates another method:
4 Public class name must be the same as the program name
4 Unexpected use of method argument
3 The dependent constructor 'com.android.commands.svc.Svc.Command(java.lang.String)' can only be used when qualified by a parent object of type 'com.android.commands.svc.Svc'
3 Unexpected END (for example no unended DO LOOP or SELECT)
3 Unexpected escape character 'b' after backslash
2 A value must be used to qualify the non-static method 'org.xml.sax.XMLReader.setFeature(java.lang.Stringbyte)'
2 Abstract methods cannot have optional arguments
2 An equals sign is expected after this property reference
2 Cannot compare primitive type 'boolean' to object reference type 'null'
2 ""Cannot convert constant value '-2147483648 320' to type 'int'""
2 Cannot override the final method in class 'android.content.ContentResolver'
2 Literal string is not ended by the end of line
2 Native methods must be empty
2 Operation not allowed on type 'android.os.Bundle'
2 Partial term has no value
2 RETURNS type for a constructor must match current class
2 Right-hand operand must not be null
2 THEN is expected after a WHEN clause
6014 CANNOT FIND IMPORT
4168 One Count Error Lines Removed




21914 Total Errors
 

On Wed, Mar 2, 2016 at 3:16 PM, Jason Martin <[hidden email]> wrote:
Write TRUE or FALSE in a NetRexx way 

Update DumpVisitor.java

public void visit(BooleanLiteralExpr n, Object arg) {
if (n.getValue()) {
printer.print("1");
} else {
printer.print("0");
}
}


Update java2nrx.java

System.out.println("java2nrx, the translator translator, version 1.0.3");


Update build.xml

<attribute name="Implementation-Version" value="1.0.3" />


Added Note:

When I use, I always place java2nrx.sh and the Jar file in my NetRexx/bin so it's always available to me.


_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Re: Small changes for java2nrx

Jason Martin
In reply to this post by Jason Martin
# If you have SHELL and may HELP some SHELL user later on

# Copy Sources to Junk dir

# CD to /Junk

# Batch Convert
find . -type f -name "*.java" -exec java2nrx.sh "{}" \;

# Apply Bug Fix hacks
find . -type f -name "*.nrx" -exec sed -i -e 's/abstract abstract/abstract/g' "{}" \;
find . -type f -name "*.nrx" -exec sed -i -e 's/dependent interface/interface/g' "{}" \;
find . -type f -name "*.nrx" -exec sed -i -e 's/dependent public interface/public interface/g' "{}" \;
find . -type f -name "*.nrx" -exec sed -i -e 's/dependent private interface/private interface/g' "{}" \;

# Compile one at time. NOT building anything here-Don't care
find . -type f -name "*.nrx" -exec nrc "{}" \;


On Wed, Mar 2, 2016 at 3:16 PM, Jason Martin <[hidden email]> wrote:
Write TRUE or FALSE in a NetRexx way 

Update DumpVisitor.java

public void visit(BooleanLiteralExpr n, Object arg) {
if (n.getValue()) {
printer.print("1");
} else {
printer.print("0");
}
}


Update java2nrx.java

System.out.println("java2nrx, the translator translator, version 1.0.3");


Update build.xml

<attribute name="Implementation-Version" value="1.0.3" />


Added Note:

When I use, I always place java2nrx.sh and the Jar file in my NetRexx/bin so it's always available to me.


_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/