User:Kevin Reid/Converting Java code

While converting Java files to E for E-on-CL, I developed this set of regular expression replacements to reduce the work needed. Apply them in sequence.

TODO: convert this into a program

^import (.*)\.(.*);$

def make$2 := &lt;import:$1.make$2&gt; def $2 := make$2.asType

^( *)// $1#

public class (.)(.*) extends (.*) \{

def make$1$2 implements DeepFrozen { def \L$1\E$2 extends $3 {

public class (.)(.*) \{

def make$1$2 implements DeepFrozen { def \L$1\E$2 {

public (\w+) (\w+)\(([^]*?)\) \{ to $2($3) :$1 {

to(.*)\(((?:.*?, )*)([A-Z]\w*|int|long|float|double) ([a-z]\w*) to$1($2$4 :$3

:any

= :=

private final (\w+) (\w+); def $2 :$1 := ...

new ([A-Z]\w*)\( make$1\(