bahmanm

joined 2 years ago
MODERATOR OF
 

cross-posted from: https://lemmy.ml/post/24400832

This is a simple example of the level of Java inter-op bjForth currently provides.

 

This is a simple example of the level of Java inter-op bjForth currently provides.

[–] [email protected] 1 points 5 months ago

Not really I'm afraid. Effects can be anywhere and they are not wrapped at all.

In technical terms it's stack-oriented meaning the only way for functions (called "words") to interact with each other is via a parameter stack.

Here's an example:

: TIMES-10  ( x -- y )
  10 
  * 
;

12
TIMES-10
.S
120

TIMES-10 is a word which pops one parameter from stack and pushes the result of its calculation onto stack. The ( x -- y) is a comment which conventionally documents the "stack effect" of the word.

Now when you type 12 and press RETURN, the integer 12 is pushed onto stack. Then TIMES-10 is called which in turn pushes 10 onto stack and invokes * which pops two values from stack and multiplies them and pushes the result onto stack.

That's why when type .S to see the contents of the stack, you get 120 in response.

Another example is

5 10 20 - *
.S
50

This simple example demonstrates the reverse Polish notation (RPN) Forth uses. The arithmetic expression is equal to 5 * (20 - 10) the result of which is pushed onto stack.

PS: One of the strengths of Forth is the ability to build a vocabulary (of words) around a particular problem in bottom-to-top fashion, much like Lisp. PPS: If you're ever interested to learn Forth, Starting Forth is a fantastic resource.

[–] [email protected] 6 points 5 months ago (11 children)

Besides the fun of stretching your mental muscles to think in a different paradigm, Forth is usually used in the embedded devices domain (like that of the earlier Mars rover I forgot the name of).

This project for me is mostly for the excitement and joy I get out of implementing a Forth (which is usually done in Assembler and C) on the JVM. While I managed to keep the semantics the same the underlying machinery is vastly different from, say, GForth. I find this quite a pleasing exercise.

Last but not least, if you like concatenative but were unable to practice fun on the JVM, bjForth may be what you're looking for.

Hope this answers your question.

[–] [email protected] 1 points 5 months ago

Whoa! This is pretty rad! Thanks for sharing!

 

cross-posted from: https://lemmy.ml/post/24148184

I'm thrilled to announce the release of bjForth v0.0.3 🎉

There's been a a heap of improvements and additions compared to the last release.

What's best is that they are automatically tested every time a change is pushed 😎

I dare you to Grab the latest tarball and hack yourself some serious Forth 😄

 

I'm thrilled to announce the release of bjForth v0.0.3 🎉

There's been a a heap of improvements and additions compared to the last release.

What's best is that they are automatically tested every time a change is pushed 😎

I dare you to Grab the latest tarball and hack yourself some serious Forth 😄

[–] [email protected] 2 points 5 months ago (2 children)

That's definitely an interesting idea. Thanks for sharing.

Though it means that someone down the line must have written a bootstrap programme with C/Assembler to run the host forth.

In case of jbForth, I decided to write the bootstrap too.

[–] [email protected] 2 points 5 months ago (4 children)

That's impossible unless you've got a Forth machine.

Where the OS native API is accessible via C API, you're bound to write, using C/C++/Rust/etc, a small bootstrap programme to then write your Forth on top of. That's essentially what bjForth is at the moment: the bootstrap using JVM native API.

Currently I'm working on a set of libraries to augment the 80-something words bjForth bootstrap provides. These libraries will be, as you suggested, written in Forth not Java because they can tap into the power of JVM via the abstraction API that bootstrap primitives provide.

Hope this makes sense.

[–] [email protected] 2 points 5 months ago (6 children)

Haha...good point! That said bjForth is still a fully indirect threaded Forth. It's just that instead of assembler and C/C++ it calls Java API to do its job.

 

cross-posted from: https://lemmy.ml/post/23785552

After nearly 2 years of work, I'm excited to release the first version of bjForth, featuring partial JONESFORTH compatibility and initial Java interop.

Grab it and start hacking: https://github.com/bahmanm/bjforth/releases/tag/v0.0.2

PS: bjForth is a Forth (indirect threaded) written entirely in Java and its execution model is influenced by that of JONESFORTH.

 

cross-posted from: https://lemmy.ml/post/23785552

After nearly 2 years of work, I'm excited to release the first version of bjForth, featuring partial JONESFORTH compatibility and initial Java interop.

Grab it and start hacking: https://github.com/bahmanm/bjforth/releases/tag/v0.0.2

PS: bjForth is a Forth (indirect threaded) written entirely in Java and its execution model is influenced by that of JONESFORTH.

 

After nearly 2 years of work, I'm excited to release the first version of bjForth, featuring partial JONESFORTH compatibility and initial Java interop.

Grab it and start hacking: https://github.com/bahmanm/bjforth/releases/tag/v0.0.2

PS: bjForth is a Forth (indirect threaded) written entirely in Java and its execution model is influenced by that of JONESFORTH.

 

cross-posted from: https://lemmy.ml/post/23703703

Hey all.

First off, bjForth is a Forth written from the ground up with modern Java and its execution model is largely influenced by that of JONESFORTH.

Currently I'm working on Java inter-op and would like to ask for your opinions/experience on semantics and syntax.

The relevant GitHub issue.

Thanks in advance.

 

Hey all.

First off, bjForth is a Forth written from the ground up with modern Java and its execution model is largely influenced by that of JONESFORTH.

Currently I'm working on Java inter-op and would like to ask for your opinions/experience on semantics and syntax.

The relevant GitHub issue.

Thanks in advance.

 

cross-posted from: https://lemmy.ml/post/22575070

bmakelib (which is a minimalist standard library for GNU Make) v0.8.0 was released last week.

The highlight of the release is the ability to use maps/dictionaries in your makefiles!

Here's the example from the release page:

$(call bmakelib.dict.define,THIS_BUILD)
$(call bmakelib.dict.put,THIS_BUILD,arch,x86_64)
$(call bmakelib.dict.put,THIS_BUILD,dir,/tmp/my-app/build)

some-target :
	@echo BUILD.arch = $(call bmakelib.dict.get,BUILD,arch)  # x86_64
	@echo BUILD.arch = $(call bmakelib.dict.get,BUILD,dir)   # /tmp/my-app/build
 

bmakelib (which is a minimalist standard library for GNU Make) v0.8.0 was released last week.

The highlight of the release is the ability to use maps/dictionaries in your makefiles!

Here's the example from the release page:

$(call bmakelib.dict.define,THIS_BUILD)
$(call bmakelib.dict.put,THIS_BUILD,arch,x86_64)
$(call bmakelib.dict.put,THIS_BUILD,dir,/tmp/my-app/build)

some-target :
	@echo BUILD.arch = $(call bmakelib.dict.get,BUILD,arch)  # x86_64
	@echo BUILD.arch = $(call bmakelib.dict.get,BUILD,dir)   # /tmp/my-app/build
 

cross-posted from: https://lemmy.ml/post/22574276

If there was one reason I liked coding in Java, it'd be AssertJ and its brilliant extensibility.

The image is an example of it from bjForth

The ability to create custom assertions makes the test code concise and read naturally.

[–] [email protected] 2 points 1 year ago

Thanks for the pointer! Very interesting. I actually may end up doing a prototype and see how far I can get.

[–] [email protected] 1 points 1 year ago

Thanks. Bookmarked the site. Also noted RE age.

[–] [email protected] 1 points 1 year ago

Thanks. I'd go the online route if my kid was a few years older but given the age, I believe in-person lessons are the best for now.

[–] [email protected] 1 points 1 year ago

Thanks. Bookmarked.

[–] [email protected] 1 points 2 years ago

UPDATE: lemmy.ml is now on lemmy-meter 🥳

[–] [email protected] 19 points 2 years ago

Good question!

IMO a good way to help a FOSS maintainer is to actually use the software (esp pre-release) and report bugs instead of working around them. Besides helping the project quality, I'd find it very heart-warming to receive feedback from users; it means people out there are actually not only using the software but care enough for it to take their time, report bugs and test patches.

view more: next ›