3 ms·
Perhaps worth noting: java bytecode is a concatenative language. There are probably more commercially interesting java corpora than forth corpora. If you want
by fizx 14y ago
Perhaps worth noting: java bytecode is a concatenative language. There are probably more commercially interesting java corpora than forth corpora.
If you want to get paid to play around with this thought, my contact info is in my HN profile.
- RodgerTheGreat 14y agoJava bytecode is stack-based, but it isn't really concatenative. The term "concatenative" refers to how code fragments can be composed via concatenation. This means that simple textual substitution is sufficient for inlining code or breaking code into functions. For example, consider a Forth word which determines whether a number is divisible by three or five: : fizzbuzzable dup 3 mod 0= swap 5 mod 0= or ; There's a repeated pattern here, so we can textually excise it and make it into a named word without changing any of the structure of the surrounding program: : /? mod 0= ; : fizzbuzzable dup 3 /? swap 5 /? or ; Or we could break it down a different way by excising different fragments: : /3? 3 mod 0= ; : /5? 5 mod 0= ; : fizzbuzzable dup /3? swap /5? or ; (Obviously not the best real-world example, but hopefully it illustrates the idea.) Java bytecode, on the other hand, uses local variable references and activation records. This means that inlining or breaking out a procedure has pretty much the same problems as inlining or breaking out a procedure manually in C- variable names may clash, new arguments have to be threaded around, parts of expressions may need to be stored in temporary variables, etc. the JVM additionally enforces many constraints on "well-formed" bytecode at class load time[1] which could make it hard to generate valid programs by chance. Overall, Trying to "harvest" java bytecode from the wild could be useful, but I think that would be much harder than it sounds at first. [1] http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html#jvms-4.9 http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.htm... (and below)