Live data from Hacker News

PunyForth: Forth inspired programming language for the ESP8266

github.com

41–47 of 47 posts

Re: PunyForth: Forth inspired programming language for the ESP8266

#41
post #38

Earlier quoted context omitted.

My problem with Lua and MicroPython is that your actual code takes up memory, ie even comments. Micropython can now compile to bytecode and load that, though, so it's better. I've had problems with Lua trying to load one or two hundred lines, though.

Lua is perfectly capable of compiling to bytecode and running that as well...

[deleted]

Re: PunyForth: Forth inspired programming language for the ESP8266

#42
post #4

This is fantastic! Forth's simplicity is a great fit for exploratory programming on resource-constrained systems, and I'm a fan of anything homoiconic. Maybe one day I'll get my dream of having a forth or lisp with the type system of haskell.

Have you looked at Kitten? It's statically typed[0], and a descendant of Cat[1], which is a descendant of Joy[2]. So those might also be interesting languages to investigate

> The Kitten Programming Language

> Kitten is a statically typed, stack-based functional programming language designed to be simple and fast. It is a concatenative language, combining aspects of imperative and pure functional programming. There is an introduction available and a tutorial in progress.

http://kittenlang.org/

[0] http://evincarofautumn.blogspot.se/search/label/Concatenativ...

[1] http://www.codecommit.com/blog/cat/the-joy-of-concatenative-...

http://www.codecommit.com/blog/cat/the-joy-of-concatenative-...

http://www.codecommit.com/blog/cat/the-joy-of-concatenative-...

[2] https://en.wikipedia.org/wiki/Joy_(programming_language)

Re: PunyForth: Forth inspired programming language for the ESP8266

#43
post #37
post #18

I'm reminded of my good old Forth times (6502 on Commodore PET), and I'm glad that Forth gets the increasing attention which it actually deserves. I don't know if there is any other programming environment at all where you can have a extensible programming language, editor, compiler, interpreter, debugger, libs, and interactive shell in a few KB.

As much as I like Forth, it isn't the only player in the restricted memory arena. Several models of the Commodore PET came with 32kb of RAM, and 18kb of ROM. Here are some that reflect similar requirements. uLisp [0], 2kb of RAM, and 32kb to store the interpreter in. You can write programs at the REPL, and burn them into the EEPROM. TinyBASIC [1], since dead, is a port of the version of BASIC that used to run on the…

Yes, there are plenty of options. However, most of those options lack something while Forth is all-inclusive. All your options have no compiler while Forth compiles to threaded code which is pretty fast, about 1/10 the speed of assembler according to my experience. Your options have a linear space consumption while Forth code compiles "logarithmic" due to its extensible vocabulary. That means, if you have an 8K system (like on my former PET-2001) you need 4K for a convenient basic Forth for instance, while you can put a lot more stuff in the other 4K, due to the threaded code.

Re: PunyForth: Forth inspired programming language for the ESP8266

#44
post #43
post #37

Earlier quoted context omitted.

As much as I like Forth, it isn't the only player in the restricted memory arena. Several models of the Commodore PET came with 32kb of RAM, and 18kb of ROM. Here are some that reflect similar requirements. uLisp [0], 2kb of RAM, and 32kb to store the interpreter in. You can write programs at the REPL, and burn them into the EEPROM. TinyBASIC [1], since dead, is a port of the version of BASIC that used to run on the…

Yes, there are plenty of options. However, most of those options lack something while Forth is all-inclusive. All your options have no compiler while Forth compiles to threaded code which is pretty fast, about 1/10 the speed of assembler according to my experience. Your options have a linear space consumption while Forth code compiles "logarithmic" due to its extensible vocabulary. That means, if you have an 8K syste…

Btw. for those who are interested in Forth, I recommend to read the "Forth Dimension" archive. It was rightly called the "best special-interest technical magazine ever".

http://www.forth.org/fd/FDcover.html

Re: PunyForth: Forth inspired programming language for the ESP8266

#45
post #43
post #37

Earlier quoted context omitted.

As much as I like Forth, it isn't the only player in the restricted memory arena. Several models of the Commodore PET came with 32kb of RAM, and 18kb of ROM. Here are some that reflect similar requirements. uLisp [0], 2kb of RAM, and 32kb to store the interpreter in. You can write programs at the REPL, and burn them into the EEPROM. TinyBASIC [1], since dead, is a port of the version of BASIC that used to run on the…

Yes, there are plenty of options. However, most of those options lack something while Forth is all-inclusive. All your options have no compiler while Forth compiles to threaded code which is pretty fast, about 1/10 the speed of assembler according to my experience. Your options have a linear space consumption while Forth code compiles "logarithmic" due to its extensible vocabulary. That means, if you have an 8K syste…

Well, TinyBASIC was available as both an interpreter, but more often, as a compiler.

Though it was a primitive compiler compared to today, due to the size of the language, it easily fit within 2-3kb, which on your 8kb system, would leave 5kb or more for program memory.

In fact, some TinyBASIC systems had a virtual machine and JIT compiler in 120 instructions, or around 2kb, as early as 1964.

Though BASIC is slower than Forth, or was in those days, the main benefit is instant availability. BASIC syntax was the jumping on point for more than a few programmers, myself included, because of it's simplicity.

Re: PunyForth: Forth inspired programming language for the ESP8266

#46
post #38

Earlier quoted context omitted.

My problem with Lua and MicroPython is that your actual code takes up memory, ie even comments. Micropython can now compile to bytecode and load that, though, so it's better. I've had problems with Lua trying to load one or two hundred lines, though.

Lua is perfectly capable of compiling to bytecode and running that as well...

Oh is it? It's been a while since I last tried it, I'll have another look, thank you!

Re: PunyForth: Forth inspired programming language for the ESP8266

#47
post #38

Earlier quoted context omitted.

Lua is perfectly capable of compiling to bytecode and running that as well...

Oh is it? It's been a while since I last tried it, I'll have another look, thank you!

Can't say about NodeMCU or whatever, but Lua has had bytecode and all since Lua 1.1, back in 1994
Post reply on HN