Author Topic: Too many programming languages?  (Read 49230 times)

0 Members and 1 Guest are viewing this topic.

Offline westfw

  • Super Contributor
  • ***
  • Posts: 4199
  • Country: us
Re: Too many programming languages?
« Reply #200 on: October 05, 2019, 11:22:47 am »
Bob Kanefsky writes (wrote?) lisp code for nasa/jpl mars missions.
Iirc, it’s sorta planning/verification code that parses and checks command streams intended to be sent to the landers, run way ahead of time.
It’s a great song.  I really like the line about assembler...

 

Online SiliconWizard

  • Super Contributor
  • ***
  • Posts: 14481
  • Country: fr
Re: Too many programming languages?
« Reply #201 on: October 05, 2019, 04:15:28 pm »
C is an utter minefield in comparison.

Never said C would be an appropriate language to teach programming either. ;D

Oh well. Never tickle LISP users...
 

Offline techman-001

  • Frequent Contributor
  • **
  • !
  • Posts: 748
  • Country: au
  • Electronics technician for the last 50 years
    • Mecrisp Stellaris Unofficial UserDoc
Re: Too many programming languages?
« Reply #202 on: October 06, 2019, 11:59:03 am »
Bob Kanefsky writes (wrote?) lisp code for nasa/jpl mars missions.
Iirc, it’s sorta planning/verification code that parses and checks command streams intended to be sent to the landers, run way ahead of time.
It’s a great song.  I really like the line about assembler...

It's a great song and kinda catchy.

The bit about assembler is generally true but I have a few Forth tools that make writing/testing assembly much faster and a lot easier than traditional assembly methods.

What you're looking at here is in fact Forth code, looks a lot like assembly doesn't it ? Forth can do that :)

      : ms ( u -- )           \ Blocking delay for use on STM32F0xx @ 8MHz RC Clock. "1000 ms" = 1 second delay
l-:   ldr= r0 1913   
l-:   subs r0 #1
      bne -
      subs r6 #1
      bne --      
      drop
      ;

This is the actual "ms" Word disassembly after it has been compiled by Forth: The movs,lsls and adds commands are the only way to load a Cortex-M0 register with a value greater than 8 bits without referencing the PC (using Thumb). The ldr= Word works out the shortest possible sequence of movs,lsls and adds for the given value. If you shift 0xef left 3 places then add 1, you get 1913.

: calc $ef 3 lshift 1 + . cr ;  ok.
 calc 1913

"ms" Word disassembly
--------------------------------
200005B8: 20EF  movs r0 #EF
200005BA: 00C0  lsls r0 r0 #3
200005BC: 3001  adds r0 #1
200005BE: 3801  subs r0 #1
200005C0: D1FD  bne 200005BE
200005C2: 3E01  subs r6 #1
200005C4: D1F8  bne 200005B8

Once I've developed my delay word and tested it, I can then just inline the Machine Code into a Forth Word like this, which doesn't need the "Interactive Assembler" facility I used above:

: ms ( u -- )     \ millisecond blocking delay for Cortex-m0 with 8MHz rc clock (mecrisp-stellaris default)
   [       
   $20EF h,
   $00C0 h,
   $3001 h,
   $3801 h,
   $D1FD h,
   $3E01 h,
   $D1F8 h,
   ] drop
 ;
 

Offline legacy

  • Super Contributor
  • ***
  • !
  • Posts: 4415
  • Country: ch
Re: Too many programming languages?
« Reply #203 on: October 06, 2019, 12:15:38 pm »
I am really thinking about pushing a micro Forth or Lisp core inside the Linux kernel (yes, in kernel space), because Kgdb with "early console" sucks ass on the SGI/MIPS IP30(1), and because I need a way to reverse engineer a blasted IBM-SGI crossbar chip, whose behavior is weird and covered by no public documentation.

With ucLisp, or Forth in Kernel space, it would be possible to modify the kernel behavior around that blasted crossbar chip realtime and interactively, without recompiling anything.



(1) the first serial console usable is behind a PCI bridge, which is behind the crossbar chip  :palm:
 

Offline legacy

  • Super Contributor
  • ***
  • !
  • Posts: 4415
  • Country: ch
Re: Too many programming languages?
« Reply #204 on: October 06, 2019, 12:33:34 pm »


This is the hardware I am talking about. Note the hacked front plane: we added a mechanism to remotely reboot (and power on/off) the machine when the kernel screws up.



We have recently developed two holy software functions, "machine_poweroff()" and "machine_reset()", which do their job, but ... you cannot trust them, because sometimes that blasted crossbar chip (which is also a "heart" chip) goes nuts with the SMP and it gets the CPUs completely out of control.

And here is where the hacked front pannel plays its trick and saves your day.

So, we are afraid of no freak-ghost in kernel space  :D
 

Offline legacy

  • Super Contributor
  • ***
  • !
  • Posts: 4415
  • Country: ch
Re: Too many programming languages?
« Reply #205 on: October 06, 2019, 12:37:24 pm »
(to be continued ... in 2020, 2021 ... )
 

Offline tggzzz

  • Super Contributor
  • ***
  • Posts: 19517
  • Country: gb
  • Numbers, not adjectives
    • Having fun doing more, with less
Re: Too many programming languages?
« Reply #206 on: October 06, 2019, 12:47:26 pm »
C is an utter minefield in comparison.

Never said C would be an appropriate language to teach programming either. ;D

Oh well. Never tickle LISP users...

There is too much "inappropriate teaching", unfortunately. Prodding LISP users can be fun, provided care is taken to ensure everybody realises what is happening :) (Ditto Java/C++/xC/Ada/Smalltalk/Rust/VHDL/etc)
There are lies, damned lies, statistics - and ADC/DAC specs.
Glider pilot's aphorism: "there is no substitute for span". Retort: "There is a substitute: skill+imagination. But you can buy span".
Having fun doing more, with less
 

Online SiliconWizard

  • Super Contributor
  • ***
  • Posts: 14481
  • Country: fr
Re: Too many programming languages?
« Reply #207 on: October 06, 2019, 03:47:37 pm »
I am really thinking about pushing a micro Forth or Lisp core inside the Linux kernel (yes, in kernel space)

Whereas I'm sure some in your team are pushing for an Erlang runtime. ;D
 

Offline legacy

  • Super Contributor
  • ***
  • !
  • Posts: 4415
  • Country: ch
Re: Too many programming languages?
« Reply #208 on: October 06, 2019, 04:02:58 pm »
Whereas I'm sure some in your team are pushing for an Erlang runtime. ;D

We have already pushed it onto a MIPS/LE router, and it's experimental profiled as common userspace application; while uLisp or uForth in Kernel space is really something *freak*, but it's necessary because we have no freak idea how to reverse engineering that freak hardaware.

With freak hardware stuff, you need freak tools to fight your battles ;D


 

Offline legacy

  • Super Contributor
  • ***
  • !
  • Posts: 4415
  • Country: ch
Re: Too many programming languages?
« Reply #209 on: October 06, 2019, 04:11:40 pm »


A lot of work to make it happen, but this actually runs Erlang  :o :o :o
 

Online SiliconWizard

  • Super Contributor
  • ***
  • Posts: 14481
  • Country: fr
Re: Too many programming languages?
« Reply #210 on: October 06, 2019, 04:17:59 pm »
A lot of work to make it happen, but this actually runs Erlang  :o :o :o

Nice. Now program this in Rust. :P
 

Offline legacy

  • Super Contributor
  • ***
  • !
  • Posts: 4415
  • Country: ch
Re: Too many programming languages?
« Reply #211 on: October 06, 2019, 04:36:06 pm »
Rust cannot be compiled on MIPS at the moment, because it depends on LLVM, which has some emm emm quriks and problems with MIPS  :o :o :o

(the above router is MIPS32-r2/LE:32bit, while the above big-iron machine is MIPS4-6/BE:64bit)

Sooner, or later, we will push Rust on PowerPC (maybe also POWER9? any sponsor here?), while on HPPA we have to give up because LLVM has never been planned to happen.

Anyway, the above Erlang-router has two purposes: our pleasure to play with (which offers a good psycological motivation to seriously learn it), and to satisfy a new-customer request.

 

Offline techman-001

  • Frequent Contributor
  • **
  • !
  • Posts: 748
  • Country: au
  • Electronics technician for the last 50 years
    • Mecrisp Stellaris Unofficial UserDoc
Re: Too many programming languages?
« Reply #212 on: October 06, 2019, 09:19:49 pm »
Whereas I'm sure some in your team are pushing for an Erlang runtime. ;D

We have already pushed it onto a MIPS/LE router, and it's experimental profiled as common userspace application; while uLisp or uForth in Kernel space is really something *freak*, but it's necessary because we have no freak idea how to reverse engineering that freak hardaware.

With freak hardware stuff, you need freak tools to fight your battles ;D

Is there a uForth ? Normal Forth is the smallest interactive binary you'll ever find apart from Basic (ughh brain damage awaits there) I think.
 

Online Sal Ammoniac

  • Super Contributor
  • ***
  • Posts: 1674
  • Country: us
Re: Too many programming languages?
« Reply #213 on: October 07, 2019, 04:04:25 pm »
sicp is a great book, but it's designed for people with very high mathematical knowledge and there are much better Scheme choices for average programmers.

That I would (partially) agree with. Scheme is simple, but the SICP book quickly gets difficult for average people. I would say that wasn't an issue for its original target audience--MIT students--who are hardly average.

When I went through that book, I had previously written thousands of lines of Elisp (EMACS' extension language), so I was already familiar with LISP (which Scheme is based on).
Complexity is the number-one enemy of high-quality code.
 

Offline westfw

  • Super Contributor
  • ***
  • Posts: 4199
  • Country: us
Re: Too many programming languages?
« Reply #214 on: October 08, 2019, 02:08:53 am »
Quote
Is there a uForth ?
For a kernel-internal Forth like I think Legacy was talking about, I'd consider anything that doesn't interface directly OS services as a sort of "MicroForth."  You know, for Poking around at the OS datastructures and such for debugging purposes, but not for actually being a larger-system programming language...
 

Offline bjdhjy888Topic starter

  • Regular Contributor
  • *
  • Posts: 62
  • Country: ca
Re: Too many programming languages?
« Reply #215 on: October 09, 2019, 03:19:30 am »
Does westfw believe the earth is flat? Yes.
Does westfw believe NASA astronauts did not land on the moon? Yes.
Does westfw believe Forth is ranked as the number 1 programming language in 2019? YES!
Does westfw want to hire me as a programmer, where I only know C++? YES! YES!
 :popcorn:
 

Offline legacy

  • Super Contributor
  • ***
  • !
  • Posts: 4415
  • Country: ch
Re: Too many programming languages?
« Reply #216 on: October 09, 2019, 06:03:26 am »
[..] I'd consider anything that doesn't interface directly OS services as a sort of "MicroForth."  You know, for Poking around at the OS datastructures and such for debugging purposes, but not for actually being a larger-system programming language...

yup, precisely. It's a crazy idea, I know, but I am out of alternatives  :-//
 

Offline techman-001

  • Frequent Contributor
  • **
  • !
  • Posts: 748
  • Country: au
  • Electronics technician for the last 50 years
    • Mecrisp Stellaris Unofficial UserDoc
Re: Too many programming languages?
« Reply #217 on: October 09, 2019, 06:04:14 am »
Does westfw believe the earth is flat? Yes.
Does westfw believe NASA astronauts did not land on the moon? Yes.
Does westfw believe Forth is ranked as the number 1 programming language in 2019? YES!
Does westfw want to hire me as a programmer, where I only know C++? YES! YES!
 :popcorn:

Whilst I can't presume to speak for Westfw, I feel it's more likely that he believes that you have poor fact retention because I'm the Forth guy around here, not him.

Westfw is merely your highly experienced embedded professional with serious credibility, very wide experience, impeccable manners and the patience of Job.

I  don't have any programming positions open, but if I need a clown, I'll bear you in mind.
 
The following users thanked this post: bjdhjy888

Offline techman-001

  • Frequent Contributor
  • **
  • !
  • Posts: 748
  • Country: au
  • Electronics technician for the last 50 years
    • Mecrisp Stellaris Unofficial UserDoc
Re: Too many programming languages?
« Reply #218 on: October 09, 2019, 06:06:34 am »
[..] I'd consider anything that doesn't interface directly OS services as a sort of "MicroForth."  You know, for Poking around at the OS datastructures and such for debugging purposes, but not for actually being a larger-system programming language...

yup, precisely. It's a crazy idea, I know, but I am out of alternatives  :-//

Why crazy ?
Freebsd uses Forth as a bootloader (FICL).
 

Offline legacy

  • Super Contributor
  • ***
  • !
  • Posts: 4415
  • Country: ch
Re: Too many programming languages?
« Reply #219 on: October 09, 2019, 06:31:44 am »
Why crazy ?
Freebsd uses Forth as a bootloader (FICL).

well, even the PowerMac's firmware comes with a Forth interpreter, but it doesn't operate inside any kernel, it's a bootloader, and it loads a kernel  :D

While I am going to push an interpreter inside the kernel, that is the crazy part, and it's so really crazy, that it only makes sense *IF* and only *IF* you cannot use kgdb or any hardware debugger (e.g. BDI2000? for IP30? forget it, there is no kwnon and documented e/jtag) for debugging the kernel.
 

Offline techman-001

  • Frequent Contributor
  • **
  • !
  • Posts: 748
  • Country: au
  • Electronics technician for the last 50 years
    • Mecrisp Stellaris Unofficial UserDoc
Re: Too many programming languages?
« Reply #220 on: October 09, 2019, 06:48:07 am »
Why crazy ?
Freebsd uses Forth as a bootloader (FICL).

well, even the PowerMac's firmware comes with a Forth interpreter, but it doesn't operate inside any kernel, it's a bootloader, and it loads a kernel  :D

While I am going to push an interpreter inside the kernel, that is the crazy part, and it's so really crazy, that it only makes sense *IF* and only *IF* you cannot use kgdb or any hardware debugger (e.g. BDI2000? for IP30? forget it, there is no known and documented e/jtag) for debugging the kernel.

DOH! of course. Apologies.

Even so, as your aim is to obtain information on "that blasted crossbar chip" would not a self contained Forth help to investigate and map that chips operation within the hardware itself ?
 

Offline legacy

  • Super Contributor
  • ***
  • !
  • Posts: 4415
  • Country: ch
Re: Too many programming languages?
« Reply #221 on: October 09, 2019, 07:03:14 am »
Even so, as your aim is to obtain information on "that blasted crossbar chip" would not a self contained Forth help to investigate and map that chips operation within the hardware itself ?

Precisely  :D

Consider that there is no directly exposed PCI bridge, hence you cannot open a PCI window anywhere to attach anything, neither a PCI bus analyzer. Oh, and there is also no jtag.

This explains why we are still unable to plug a PCI-USB card in the XIO-PCI cadge with success although the IP30 has been reverse-engineered in the last 15 years.

I believe, don't want to appear arrogant, but I believe it's time to try a different approach  :D
 

Offline GeorgeOfTheJungle

  • Super Contributor
  • ***
  • !
  • Posts: 2699
  • Country: tr
Re: Too many programming languages?
« Reply #222 on: October 09, 2019, 07:30:22 am »
I run this sort-of-forth in all my esp32s: "Autodesk Threaded Language Application System Toolkit"

https://www.fourmilab.ch/atlast/
https://www.eevblog.com/forum/microcontrollers/somebody-goofed-up/msg2668650/#msg2668650

Just "nc esp32ip 23" and voilà, c'est magnifique!
The further a society drifts from truth, the more it will hate those who speak it.
 
The following users thanked this post: techman-001

Offline techman-001

  • Frequent Contributor
  • **
  • !
  • Posts: 748
  • Country: au
  • Electronics technician for the last 50 years
    • Mecrisp Stellaris Unofficial UserDoc
Re: Too many programming languages?
« Reply #223 on: October 09, 2019, 08:49:02 am »
I run this sort-of-forth in all my esp32s: "Autodesk Threaded Language Application System Toolkit"

https://www.fourmilab.ch/atlast/
https://www.eevblog.com/forum/microcontrollers/somebody-goofed-up/msg2668650/#msg2668650

Just "nc esp32ip 23" and voilà, c'est magnifique!

George, very nice, thanks for the link!

Every Forth I have seen is different, no two are alike. There really isn't a "standard Forth" in my opinion. Every one is a "sort of Forth".

Even Chuck Moore ( the father of Forth) when asked "what is Forth ?" replied "I can't say for sure, but I know it when I see it".

From the Atlast document:-

... "So what is Atlast? Well...it's FORTH, more or less. Now I'm well aware that the mere mention of FORTH stimulates a violent immune reaction in many people second, perhaps, only to that induced by the utterance of the dreaded word "LISP." Indeed, more that 12 years after my first serious encounter with FORTH, I am only now coming to feel that I am truly beginning to "get it"--to understand what it's really about, what its true strengths (and weaknesses) are, and to what problems it can offer uniquely effective solutions."

"... Atlast™ is a toolkit that makes applications programmable. Deliberately designed to be easy to integrate both into existing programs and newly-developed ones, Atlast provides any program that incorporates it most of the benefits of programmability with very little explicit effort on the part of the developer. Indeed, once you begin to “think Atlast” as part of the design cycle, you'll probably find that the way you design and build programs changes substantially. I'm coming to think of Atlast as the “monster that feeds on programs,” because including it in a program tends to shrink the amount of special-purpose code that would otherwise have to be written while resulting in finished applications that are open, extensible, and more easily adapted to other operating environments such as the event driven paradigm. .."

Compiled fast and easily and running on Freebsd:
atlast-2.0% ./atlast
ATLAST 2.0 (2014-07-04) [64-bit] This program is in the public domain.
-> 2 2 + .
4 -> words

STDERR
STDOUT
STDIN
+
-
*
/
MOD
/MOD
MIN
MAX
NEGATE
ABS
=
<>
>
<
>=
<=
AND
->
 
The following users thanked this post: GeorgeOfTheJungle

Offline GeorgeOfTheJungle

  • Super Contributor
  • ***
  • !
  • Posts: 2699
  • Country: tr
Re: Too many programming languages?
« Reply #224 on: October 09, 2019, 09:01:27 am »
Splendid!  :clap:

How does it compare to the other Forths you use? Is it speedy? Is the binary small-ish? How does the .bin size compare to the other ones you've got?

Edit:
I'd want to use the smallest one I can find, because I'm seeing quite a lot of flash cache misses. That slows down my esp32s.
« Last Edit: October 09, 2019, 01:09:01 pm by GeorgeOfTheJungle »
The further a society drifts from truth, the more it will hate those who speak it.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf