Live data from Hacker News

PunyForth: Forth inspired programming language for the ESP8266

github.com

31–40 of 47 posts

Re: PunyForth: Forth inspired programming language for the ESP8266

#31
post #28

Earlier quoted context omitted.

Most importantly, the ESP32 has register windows.

Right, this is the kind of information I was looking for (maybe some actual ISA documentation; the instruction encoding method itself, etc). But for this specific point -- I thought all of the Xtensa series used register windows? Or did they both have them but the ESP8266 never actually use them (somehow?)

The xtensa series is highly configurable, afaik the ESP8266 doesn't have them in hardware.

This is second hand knowledge though.

Re: PunyForth: Forth inspired programming language for the ESP8266

#32

I am wondering why the team from mbed has not made an attempt to make ESP8266 compliant with mbed. Yes, I understand that the architecture is totally different but just that I like mbed so much so that I want to see it used in more hardware.

mbed team would not do that. The compiler used in mbed platform is NOT gcc but ARM Compiler.

Re: PunyForth: Forth inspired programming language for the ESP8266

#33
post #9

Earlier quoted context omitted.

Aren't these conflicting ideas? To me a big advantage of dynamic type systems is that specifying behaviour and specifying what parts of the behaviour are statically computed are separate tasks.

Yes. For example, the powerful "transducers" concept from Clojure essentially cannot be represented in the Haskell type system.

Here's an attempt: http://hypirion.com/musings/haskell-transducers

Re: PunyForth: Forth inspired programming language for the ESP8266

#34
post #26
post #22

Earlier quoted context omitted.

Wouldn't Rust be overkill? I think Forth is much more suitable here. You can implement a lot of features in 512K. You can extend the code (and language!) at runtime, you can debug remotely, and do other nice things.

Yes, but Forth doesn't have a borrow checker, so how will you know you're using memory safely?

These Rust trolls (at least I hope, for your sake, that you are trolling here and not serious) are getting annoying.

One would wonder how we managed to cope before Rust. Also, you should ask these guys [1] [2] how they know they're using memory safely. Has Rust ever been used to fly aircraft and fricking space shuttles? I didn't think so.

[1] https://web.archive.org/web/20110204160744/http://forth.gsfc...

[2] https://en.wikipedia.org/wiki/Open_Firmware

Re: PunyForth: Forth inspired programming language for the ESP8266

#35
post #5
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.

Did you see the Factor language?

Factor is cool, but never really took off or got much attention. The creator, Slava has moved on to other things (Swift compiler I think). I posted something on another concatenative language (kitten) on here recently and the author jumped on and the conversation was good (Factor was brought up as well).

Re: PunyForth: Forth inspired programming language for the ESP8266

#36
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.

Maybe Shen would work for you? [1] A Lisp with optional static type checking, optional lazy evaluation, pattern matching, a built-in Prolog, and more.

[1] http://www.shenlanguage.org/

Re: PunyForth: Forth inspired programming language for the ESP8266

#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 Altair 8800, which was an even more constrained system than most PETs! Altair BASIC could run on 4kb of RAM.

Python-On-A-Chip [2], is a subset of Python. At a guess, from the supported platforms, it can run on around 2kb of RAM.

iArduino [3], is a C interpreter that can run in 2kb of RAM.

MicroPython is looking to come to the ESP8266 [4], which is much, much bigger at 512kb. Which basically makes it the fattest of these, and impossible to run on something like the PET.

Bitlash is a completely new language [5], and can run on 2kb of RAM, and takes up surprisingly little storage space.

All of these languages offer at least a REPL, as well as compatibility with a wide range of libraries, and most have at least traceback and exception support.

This is not to say Forth is a bad choice! It works great in tiny memory, with better support for a full language specification than many other languages.

But not everyone wants a Forth... And there are plenty of choices out there.

[0] http://www.ulisp.com/

[1] http://hackaday.com/2011/08/28/basic-programming-on-an-ardui...

[2] https://github.com/jsnyder/python-on-a-chip

[3] http://n.mtng.org/ele/arduino/iarduino.html

[4] https://github.com/micropython/micropython/tree/master/esp82...

[5] https://github.com/billroy/bitlash/wiki

Re: PunyForth: Forth inspired programming language for the ESP8266

#38

Earlier quoted context omitted.

Have you seen the eLua LTR (Lua Tiny RAM) patch? http://www.eluaproject.net/doc/v0.9/en_arch_ltr.html As for Rust, why do we think that should use significantly less memory than MicroPython or Lua? I've seen some threads with people doing measurements on simple programs and finding Rust up to 10x heavier on RAM than C. http://stackoverflow.com/questions/32762102/why-do-rust-prog...

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...

Re: PunyForth: Forth inspired programming language for the ESP8266

#39
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…

Additionally one should add that the mainframes where Lisp was initially developed, were quite constrained, even when compared with 8 bit micros.

Re: PunyForth: Forth inspired programming language for the ESP8266

#40
post #2

Why can't we get Rust for the ESP8266? :( I really dislike C, I'd love a higher-level language. As great as MicroPython is, the interpreter needs too much RAM, and I think Rust would be a great alternative.

Because no one has yet bothered to port it?

As a side note, there are quite a few options to do safe micro controller system programming for those that prefer AOT compiled languages without C like unsafety.

http://www.mikroe.com/mikropascal/

http://www.mikroe.com/mikrobasic

http://www.astrobe.com

http://playground.arduino.cc/Code/AVR-Ada

Post reply on HN