Replies: 5 comments 19 replies
-
What about a C implementation with JNI wrappers? |
Beta Was this translation helpful? Give feedback.
-
My CForth could once run on a Java-based phone. It worked by transliterating C to Java with some preprocessor trickery. To make that work, I had to change all the pointer arithmetic to array references. The java code is still there, but has not been maintained in years so I would be really surprised if it still works without some tweaking. |
Beta Was this translation helpful? Give feedback.
-
You might be able to fiddle with my ancient FIJI ForthIsh Java Interpreter
<https://sourceforge.net/projects/fiji/> which is an object oriented Forth
in Java that can call into Java.
|
Beta Was this translation helpful? Give feedback.
-
Others have probably mention previous forth in java implementations, it
can't hurt
Somewhat old now but it may be of interest:
https://fiji.sourceforge.net/
I vaguely remember calling methods in java classes from forth like words.
It might be worth a look
HTH,
Andrew
…On Sun, 19 Feb 2023 at 18:20, Anthony Howe ***@***.***> wrote:
Today I got basic JNI support implemented in post4
<https://github.com/SirWumpus/post4> (not yet pushed to GitHub) where
Java can evaluate a string or file, enter the REPL, and receive exceptions.
Its pretty one way just now and needs some polish.
However thinking on the reverse, being able to call Java methods from
Forth, raises a few issues to think about:
- Object construction and passing this back to Java.
- Object life cycle. Forth needs to ensure objects it creates, via
Java constructors, and only it knows about are not GC'ed behind its back.
How to release an object (reference) when done.
- Overloaded constructors and methods. In most cases the method with
the greatest "arity` (think Erlang) is probably the ideal one to invoke,
but it assumes those with lesser arity are convenience methods.
- Java package and method names are some times stupidly long, which
might affect input buffer size.
- I/O redirection, let Java feed input, capture output.
- For file and string evaluation, are results from the data and/or
float stacks expected to be passed back to Java? How deep?
—
Reply to this email directly, view it on GitHub
<#132 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAYVWSO5PBVHM2WNYEDHZ43WYJP6VANCNFSM6AAAAAAUFQY3NA>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
3. Write Forth-like language in Java that can call Java.
https://sourceforge.net/projects/fiji/
…On Wed, Feb 22, 2023 at 9:37 AM ruv ***@***.***> wrote:
The fusion of Forth and Java can be implemented in two variants:
1.
Forth is integrated into a Java application (Java calls Forth). It can
bring to the application (I suppose):
- an interactive terminal (REPL) with introspection/debugging
facilities,
- testing, configuring, scripting (without recompilation of the
application).
2.
Access to Java from a Forth system (Forth calls Java). This brings
capabilities to:
- test/introspect/debug Java components (classes),
- partially, what JShell
<https://docs.oracle.com/javase/10/jshell/introduction-jshell.htm>
now provides.
- use libraries/components from the huge Java ecosystem in a Forth
program,
- create light wrappers/scripts over a Java component just in Forth
(without creating a Java application for that),
- as an example, once I needed a simple wrapper over Apache™ FOP
<https://xmlgraphics.apache.org/fop/> component.
—
Reply to this email directly, view it on GitHub
<#132 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABDEBBDQIDIIA5FIRI3S5ZDWYY6FXANCNFSM6AAAAAAUFQY3NA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
--
*JACK WOEHR, IBM Champion 2021-2023
<https://www.credly.com/users/jack-woehr/badges>*
*SENIOR IBM i ENGINEER*
303.847.8442
***@***.***
stay connected
<https://www.linkedin.com/company/absolute-performance-inc./>
<https://www.absolute-performance.com/>
www.absolute-performance.com
NON-DISCLOSURE NOTICE: This communication including any and all
attachments is for the intended recipient(s) only and may contain
confidential and privileged information. If you are not the intended
recipient of this communication, any disclosure, copying further
distribution or use of this communication is prohibited. If you received
this communication in error, please contact the sender and
delete/destroy all copies of this communication immediately.
|
Beta Was this translation helpful? Give feedback.
-
Could you suggest a Forth implementation that can be embedded in a Java application?
So actually it is not obligated that it's in Java, it can be in any language that compiles in JVM.
Also, it shall have some FFI to Java methods, and be able to catch exceptions in Java methods.
Beta Was this translation helpful? Give feedback.
All reactions