Forth Programming Language: Introduction

Поділитися
Вставка
  • Опубліковано 26 гру 2024

КОМЕНТАРІ •

  • @ShellacScrubber
    @ShellacScrubber 4 роки тому +16

    Finally, a Forth course!! Thank you.
    I'm new to this fascinating language but have made a start and have begun experimenting with mecrisp Forth on the "Blue pill" board.

    • @CodeAndCrux
      @CodeAndCrux  4 роки тому +2

      Nice! The blue pill with mecrisp is a great way to learn and experiment with Forth. Thanks for the comment! I hope the course serves you well.

  • @WowplayerMe
    @WowplayerMe 4 роки тому +15

    UA-cam needs to add an "I freakin love this" button!

  • @GaryChike
    @GaryChike 6 місяців тому

    Fantastic! I'm beginning my journey with Forth and its variants such as 8th.

  • @DellAnderson
    @DellAnderson 6 місяців тому

    Nice job demonstrating some simple calculations. I look forward to seeing more complex follow-up videos. I'm having a hard time imagining how this language could be of any practical use, but Chuck Moore said in the Edinburgh interview that he used it for astronomical telescopes, commercial (business) applications, databases (pre-SQL), and even Hollywood (a camera tracker for special effects compositing with accuracy to one pixel). He even used it to create a program for designing carpets - in black and white. I have a difficult time understanding how one gets from such a simple interface to those kind of applications but I long ago learned there are people way smarter than me.

  • @meanmikebojak1087
    @meanmikebojak1087 4 роки тому +7

    Nice to see intrest in FORTH coming back. Good intro too, kind of high speed though.

  • @contprogramare1126
    @contprogramare1126 2 роки тому +1

    I am 14 years old and I love FORTH.

  • @seanvogel8067
    @seanvogel8067 Рік тому

    At about 8:50, it’s not an equation, it’s an expression. The “e” in pemdas stands for exponents.

  • @freeelectron8261
    @freeelectron8261 4 роки тому +4

    Thanks! Loved it to bits. Need stacks more of these. ;)

  • @KalathilAjayMenon
    @KalathilAjayMenon 4 роки тому +9

    pemdas / bodmas.
    P
    Parentheses first
    E
    Exponents (ie Powers and Square Roots, etc.)
    MD
    Multiplication and Division (left-to-right)
    AS
    Addition and Subtraction (left-to-right)

    • @homelessrobot
      @homelessrobot 4 роки тому +3

      unfortunately, these mnemonics are not general purpose, and worse, quite a lot of mathematical notation is not well specified at all, and people apply it differently and don't agree on how. For instance, coefficient multipliers have higher precedence than exponentiation. This often leads to translation errors when writing multiplicative formulas to languages without coefficient multipliers; basically every single programming language ever. 5xy^5 is not 5 * x * y ^ 5. its (5 * x * y) ^ 5.

  • @kasperosterbye7883
    @kasperosterbye7883 2 місяці тому

    I know you wrote this 4 years ago. I so happens I implemented forth in machine code in 1982, and as you say, it is a very fast programming language, and it was a good training for me an my friends who studied computer science at the time. I assume it no longer has your interest and instruction times.

  • @FD-ze1xg
    @FD-ze1xg 3 роки тому +3

    Hi, I would like to know if Forth also uses commands for graphics to be able to make 2d games.
    Is there any documentation?
    Thank you!
    Greetings from Italy

    • @CodeAndCrux
      @CodeAndCrux  3 роки тому +2

      Yes, it does. RetroForth, in particular, has built-in WebGL functionality.
      In general, Forth can also bind with C, so you can use game engines/libraries like SDL to make games in Forth. I have a video on setting that up: ua-cam.com/video/FOnECIhAOMI/v-deo.html
      Thanks for the comment!

  • @DoggyH2O
    @DoggyH2O 4 роки тому +2

    Wow. Forth in 2020.

  • @johnwilliams7999
    @johnwilliams7999 Рік тому

    how do you get pixels and sprite on the screen using forth? that would be interesting

  • @encapsulatio
    @encapsulatio 2 роки тому

    How time consuming is to program aka be productive in Forth compared to C and even Python?

  • @ajitsakri9888
    @ajitsakri9888 3 роки тому +1

    Does qFORTH come under this?

    • @CodeAndCrux
      @CodeAndCrux  3 роки тому

      I haven’t used qFORTH, and couldn’t find any documentation on it online, but seeing it is from the Apple II era, I suspect it would be similar to most other Forth implementations.

  • @jenniferw8963
    @jenniferw8963 2 роки тому +1

    8:23 e is the exponent.

  • @cliffmathew
    @cliffmathew 2 роки тому +2

    Proceeds to explain stack with the most un-stackable things on his table 🙂, Thanks - great intro, though!

  • @bigbrothertv2167
    @bigbrothertv2167 2 роки тому

    Whats the name of the program?

  • @apgangatharan6162
    @apgangatharan6162 3 роки тому +1

    what is the main purpose of this Language
    is this low or high level language

    • @CodeAndCrux
      @CodeAndCrux  3 роки тому +1

      It’s a low level language. It is lower level than C, but a step higher than assembly. It’s good when the performance of assembly is needed, but an interpreted environment is desired, like when poking around microchips. It is also useful in situations where assembly levels of access are needed, but a more simplified language design is desirable.
      Overall, though, it’s more just fun and educational rather than useful these days.

  • @olleharstedt3750
    @olleharstedt3750 2 роки тому

    Nice and approachable video, thanks! :)

  • @FondueBrothers
    @FondueBrothers 4 роки тому +3

    Think of the Stack as a deck of cards

  • @b213videoz
    @b213videoz Рік тому

    Show how you code River Raid in this 45 years old + overglorified dinosaur of the programmibg language - then I'll be interested

  • @galihtanu
    @galihtanu 3 роки тому +1

    So it more like postfix math

  • @rayuduraavan8187
    @rayuduraavan8187 4 роки тому +1

    Can we see any forth laptops in future?? This guy founder of forth have been telling this since few decades, but no company is showing interest in this computer whatsoever

    • @christopherlawley1842
      @christopherlawley1842 4 роки тому +2

      Years back some folks left the Sinclair company (Z81 computer) and created their own version which ran FORTH natively. It was called the Jupiter ACE.
      I'm unaware of any other consumer type FORTH computers.
      I'd buy !!

    • @pacman10182
      @pacman10182 4 роки тому +1

      didn't the OLPC use forth for it's low level bios?

    • @homelessrobot
      @homelessrobot 4 роки тому +1

      @@pacman10182 lots of relatively common bootloaders and firmware architectures also use forth.

    • @davidste60
      @davidste60 4 роки тому +2

      @@christopherlawley1842 The Canon Cat used FORTH, Jeff Raskin talks about his work on it in his book about UI design "The Humane Interface".

    • @CodeAndCrux
      @CodeAndCrux  3 роки тому

      There is a Forth operating system. It's pretty interesting actually. It's called Collapse OS.

  • @jenniferw8963
    @jenniferw8963 2 роки тому

    Hah I didn't know Forth was RPN :) Reverse Polish Notation :) This is how I caclutate things on my HP 48gx

  • @presauced
    @presauced 2 роки тому

    God Forth is so ugly yet there's just something in me that loves it. Maybe because of it's simplicity?

  • @iluvyoutube6414
    @iluvyoutube6414 2 роки тому

    The e is for exponents. jeez

  • @alvin3832
    @alvin3832 4 роки тому +1

    Thanks

  • @radosawrudak8095
    @radosawrudak8095 2 роки тому

    My God this reminded my ho dump teaching order of operation with acronym is so stupid.

  • @sahhl-alkhayr
    @sahhl-alkhayr Рік тому

    Have younot seen how Allah has set forth a parable? A good word is like a good tree-its root is firm and its branches are in heaven,

  • @john_hind
    @john_hind 3 роки тому +3

    Forth is a horrible language. If ever there was an idea in computing so bad it should be consigned to the dustbin of history, it is this one (and I really, really hoped it had). I led a team in the 70s required to write code in Forth and I've never seen so much burnout and several near nervous breakdowns (including, and I can admit it now, myself!) I was mightily relived to be allowed to do my next project in Z80 assembler!
    Two comments by colleagues on this doomed project:
    1. "Fourth: the write-once, read-never language." It is only usable for any project one person can complete in one sitting without a break. Take a tea break and when you come back it takes you as long to understand what you wrote before as it took you to write it in the first place by which time you need another break, so you never make any progress.
    2. "Reading a Forth program is like translating an unfamiliar language armed only with a dictionary for native speakers". You look up the definition of one word, to understand that you have to look up the words in that definition and so on down an endless tangled root system from which you never return.
    There are some things just not worth learning, however good the tutorial. And then there is Forth which you are actually better off not knowing even if learning it is completely painless! Chuck Moore is the Byron of computer language designers: "Mad, bad and dangerous to know". I always suspected he was a kind of non-violent Unabomber - presciently doing his best to strangle the nascent computer revolution at birth!

    • @CodeAndCrux
      @CodeAndCrux  3 роки тому +5

      You make some very good points. Anything more than very simple Forth programs become a monster as far as readability goes. I couldn't imagine using Forth as a team. That must have been brutal.
      Interestingly, Forth has gained some momentum in the past couple of years in the hobbyist programming world because it is interpreted yet low level. That makes it an excellent language for poking around microcontrollers and little computers like the Raspberry Pi hardware. No need to compile, just execute code in place. Good for figuring things out. And no need to take up disk space like other interpreted languages (e.g. Python). If there were some good statistics on Forth's popularity and the Raspberry Pi's popularity, I suspect there would be a close correlation between the two.
      I decided to teach Forth because learning it gave me a deeper understanding of how computers work, much the way learning assembler does. And hacking away at it feels like a game or puzzle. But no matter how hard I think about it, and I have thought about it a good deal, I cannot come up with any good high-level use case for Forth. So your points are well taken.
      Thanks for passing along your wisdom! I think you're actually the first person I've ever had comment who could say they used Forth professionally, so that experience you shared is very valuable.
      By the way, I enjoyed your theory about Chuck Moore! 😂

    • @creditscorenz
      @creditscorenz 2 роки тому

      @@CodeAndCrux I'm using FORTH at a very high level as a report writer for the FirebirdSQL relational database. My FORTH is written on top of Python, because using Python directly introduces too many security risks e.g. unrestricted eval and file access. My FORTH is more like Javascript in that all it can do is query a database using select queries which it then transforms into HTML or CSV files. Being typeless, extensible (I regularly alter the Python FORTH REPL to make it work better for my purposes) and having a REPL that tells you EXACTLY where your code has crashed without crashing the REPL makes for very productive programming. The only problem is it takes some time to get back in the zone, if you haven't been using it for a while, compared to C code, which I can look at years after I've written it and understand it immediately. Writing inscrutable code in FORTH is very easy to do and I agree with the OP... writing masses of tiny words means you can easily lose your way going down the rabbit hole! When I first started using FORTH, I thought the answer was syntactic sugar words to hide the core words. Now, I try to avoid that, only factoring a word collection into a new word if I know I will be reusing it frequently and I use lots of comments telling me what a paragraph of words is doing. More information about my FORTH can be found at creditscorenz.blogspot.com/2021/06/safe-python-eval.html

    • @DellAnderson
      @DellAnderson 6 місяців тому

      @@creditscorenz According to my reading of the article linked in the description, your usage of Forth has the potential to be extremely dangerous, "a flamethrower crawling with cobras". I can't imagine using a language like this for security reasons.

    • @creditscorenz
      @creditscorenz 6 місяців тому

      @@DellAnderson True. Even limiting the possible Python words using Forth, it is always possible that somebody might use a Python word in a way I'd never expect resulting in a security breach. User scripting over the Internet is perhaps an impossible dream. That's how I began my journey with Forth. Now I've moved on with Forth to other things. I find it very rewarding to code in. My biggest success to date, using it to control theatre DMX lights.

  • @billpeiman8973
    @billpeiman8973 3 роки тому +2

    Painful to watch.

    • @RalphWLundvall
      @RalphWLundvall 2 роки тому

      More preparation would certainly improve the presentation. Not much youtube FORTH instruction is available.