That sounds cool, but i'm new to forth - what all can it do? can you suggest a starter's tutorial or some examples? thanks!
Hello all,
I coded a forth machine for the jvm. It runs already on my e680i.
Implemented are following commands:
: ; rot dup drop swap words forget + - * / allot constant create loop do i j +loop if then . .dup ! @
It runs within the jvm. My destination is to have a devkit completely on the phone without using a second computer. Coding everywhere.
Is anyone interested in joining the development of the forth devkit?
I use forth since 25 years and there is for shure no better language out there!![]()
% New UNIX password:
> penis
BAD PASSWORD: it's WAY too short
% New UNIX password:
That sounds cool, but i'm new to forth - what all can it do? can you suggest a starter's tutorial or some examples? thanks!
never heard from this language, but its not fortran in english?
Best books for forth are from Leo Brodie. They are also in the web:
Starting forth, http://home.iae.nl/users/mhx/sf.html
Thinking forth, http://thinking-forth.sourceforge.net/
Ehm, and yeah there is wikipedia right now.
Short description from me:
As linux is just different from windows, forth is just different from java. I took java as opposite, because it's not only opposite but they have similar concepts, a virtual machine, for example.
What I like most in forth is that it's a language far more similar to a natural language than any other programming languages I know of. Forth is like freedom where other languages are like prisons.
Let me explain with a simple example:
In C or even java the syntax is very restrictive. It is not possible to change the syntax, the compiler uses. Everytime there are these brackets {[()]} in the code. Brackets are needed, where programming languages are imperfect. Forth does the same without brackets. Everywhere! With postfix notation while calculating and with words while processing.
If this is not enough freedom, you may change the compiler at compile time. Spaces are the fundamental delimiters in forth like in any natural language. But you may change this. Even you may change any other behavier in forth.
Ok, that's enough for now. Look at wikipedia or the books. And, forth is just as far away from fortran as the sun from the earth.
I've also enclosed the first midlet. The words above are available. Just type in a sequence in the input field and then press "Ok" for processing. You will see the output in the output field. You may for example try:
which will simply print square numbers from 0 to 99.Code:100 0 do i dup * . loop
Please look at the spaces - they are important delimiters in forth!
Another example to try the dictionary of forth:
Will compile a new word "squares" when pressing Ok.Code:: squares do i dup * . loop ;
You may then enter:
to print squares of 100 to 200. Or even other ranges.Code:200 100 squares
To look then at the dictionary you may enter
to see the new created word "squares".Code:words
If you don't like squares anymore you may enter
And then withCode:forget squares
you may see nothing than ok.Code:words![]()
% New UNIX password:
> penis
BAD PASSWORD: it's WAY too short
% New UNIX password:
Thanks for the info and explaination!! One (of probably many) question is what about file and/or device access via forth? I noticed on one of the links you suggested they have a filing program and I was wondering if this could be modified to access the phone (contact, calander, etc) db files, but I am not sure if the installed KVM has filesystem access.
Welcome
It is possible to save persistent data in records, which will also go to the filesystem.
And it is also possible via midp 2.0 if I am not wrong, to access the phone database. Second, the docs at motorola stated, that filesystem access from java is possible, when the midlet is signed.
While an old stager in forth, I am brand new to java, so be patient. I'd like to implement a recordstore to the forth machine shortly. And then it is possible to save forth programs, load and run them again and again.
% New UNIX password:
> penis
BAD PASSWORD: it's WAY too short
% New UNIX password:
I just updated the "programs" a little bit and upload a new version with more help. It will be shortly available in the download section.
update: it has now new words:
cls (to clear the output screen)
emit
% New UNIX password:
> penis
BAD PASSWORD: it's WAY too short
% New UNIX password:
I've been looking at the forth references you provided and they are quite helpful, thanks!!
One application I have in mind would be a FFT calculation, and possibly some plotting. I have found a FFT example in forth but I need to figure out about the "NEEDS " and how required code is somehow included.
For something like this do you think a java based app would be easier? I am so new to this that I really don't know how the options compare.
Hmm, I don't know what do you mean exactly with "java based app would be easier". Easier than what?
@ the moment, cy4th is in its early stages. But the virtual machine works and it will be not much more work to get the complete forth basics at the phone. Even it is now possible to store files (new version 0.2.2). I hope, in a few days to get a version where it is possible to even have a file manager and automated save and load of multiple files.
The rest of the work is to code most forth words in itself (in forth) and enable this "library" to load automaticly at startup of cy4th.
When reached this state, forth is almost complete to work with. But: Only in "console" mode.
After this, there are two more huge projects:
1. Coding an api to permit forth produce gui elements like forms, textfields, ... on the phone.
2. Coding an api to the canvas classes that will enable drawing functions and may be even using of 3d apis.
If you like to draw fast fouriers you need part 2. (canvas api in forth) and that has to be coded from anyone in java (J2ME) first.
But anyway, I guess in your part it's more a question of what programming language you prefer. I don't like to press you to learn forth. You could also code another language in java or use any other way. Or even code the fft in java. It is all possible now!
For my way, I have used a dozen and more programming languages since more than 20 years and there is nothing near of forth if looking at portability, speed, elegance, rapid prototyping and freedom. So if you would ask meI would suggest to use forth.
![]()
% New UNIX password:
> penis
BAD PASSWORD: it's WAY too short
% New UNIX password:
this forth sounds a little bit like smalltalk, but not oo