Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. Building a new proper left-to-right executing programming language

Building a new proper left-to-right executing programming language

Scheduled Pinned Locked Moved The Lounge
question
43 Posts 23 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Nikunj_Bhatt

    Most of spoken languages are written LtR (Left-to-Right) but Maths, the number language, is actually written RtL because the decimal numbers are Arabic numerals. (I know, most will get surprised, but it's true about Maths RtL direction.) But somehow the RtL and LtR languages got mixed up. Instead of writing

    x = a + 12

    how about changing it to

    a + 12 = x

    So, what are your views on creating a new programming language which follows proper LtR execution? Is there already such language? (Please, just don't remind me that there are already lots of programming languages (I know already) and I must not (try to) create one more. :) )

    M Offline
    M Offline
    Member_5893260
    wrote on last edited by
    #34

    Forth (programming language) - Wikipedia[^] It never fails to amuse me how the young ones forget their history, if, indeed, they bother to learn it in the first place. Oh - and it's

    x @ 12 + x !

    1 Reply Last reply
    0
    • R Rick York

      That sounds interesting. Other than it uses Forth. :cool: That last thing I read about Forth was many years ago. It was about the development of the SPARC processor and Sun workstations. They embedded Forth in its ROMs and wrote the boot loader in it. As I recall, it came up and ran on the first attempt.

      "They have a consciousness, they have a life, they have a soul! Damn you! Let the rabbits wear glasses! Save our brothers! Can I get an amen?"

      S Offline
      S Offline
      sasadler
      wrote on last edited by
      #35

      I liked Forth a lot, but then I grew up on assembly language. The whole TIL (threaded interpreted language) scheme is extremely simple and is easily ported to different processors. One of the main problems with Forth is that the programmer is assumed to be an expert. There's pretty much no hand holding. Forth Inc. is still in business too (www.forth.com).

      R 1 Reply Last reply
      0
      • S sasadler

        I liked Forth a lot, but then I grew up on assembly language. The whole TIL (threaded interpreted language) scheme is extremely simple and is easily ported to different processors. One of the main problems with Forth is that the programmer is assumed to be an expert. There's pretty much no hand holding. Forth Inc. is still in business too (www.forth.com).

        R Offline
        R Offline
        Rick York
        wrote on last edited by
        #36

        I didn't care for Forth. I didn't grasp it immediately and it was always a struggle for me to deal with. The same applies to RPN for me. I think I was the only one in my engineering school who didn't have an HP calculator. Coincidentally, I went to school in the same town where HP designed and built them at the time.

        "They have a consciousness, they have a life, they have a soul! Damn you! Let the rabbits wear glasses! Save our brothers! Can I get an amen?"

        S 1 Reply Last reply
        0
        • R Rick York

          I didn't care for Forth. I didn't grasp it immediately and it was always a struggle for me to deal with. The same applies to RPN for me. I think I was the only one in my engineering school who didn't have an HP calculator. Coincidentally, I went to school in the same town where HP designed and built them at the time.

          "They have a consciousness, they have a life, they have a soul! Damn you! Let the rabbits wear glasses! Save our brothers! Can I get an amen?"

          S Offline
          S Offline
          sasadler
          wrote on last edited by
          #37

          I like it because of it's interactive nature. Write a 'word' and you can test it immediately. Made for much quicker development at the time. Also, it was relatively easy to make a multitasking Forth (round robin scheduling).

          B 1 Reply Last reply
          0
          • N Nikunj_Bhatt

            Most of spoken languages are written LtR (Left-to-Right) but Maths, the number language, is actually written RtL because the decimal numbers are Arabic numerals. (I know, most will get surprised, but it's true about Maths RtL direction.) But somehow the RtL and LtR languages got mixed up. Instead of writing

            x = a + 12

            how about changing it to

            a + 12 = x

            So, what are your views on creating a new programming language which follows proper LtR execution? Is there already such language? (Please, just don't remind me that there are already lots of programming languages (I know already) and I must not (try to) create one more. :) )

            B Offline
            B Offline
            BillWoodruff
            wrote on last edited by
            #38

            My views ? 1. you are wasting your time. 2. using = for assignment is evil, but, perhaps a necessary one we are stuck with forever. 3. post-fix (RPN) is no more natural, or unnatural, than any other notation. a great benefit of RPN is that you can parse it without need for recursive descent to figure out execution order.

            «Where is the Life we have lost in living? Where is the wisdom we have lost in knowledge? Where is the knowledge we have lost in information?» T. S. Elliot

            1 Reply Last reply
            0
            • S sasadler

              I like it because of it's interactive nature. Write a 'word' and you can test it immediately. Made for much quicker development at the time. Also, it was relatively easy to make a multitasking Forth (round robin scheduling).

              B Offline
              B Offline
              bluekraken
              wrote on last edited by
              #39

              Take a look at the PostScript manual. As far as I can see its FORTH with extra graphics bits.

              S 1 Reply Last reply
              0
              • B bluekraken

                Take a look at the PostScript manual. As far as I can see its FORTH with extra graphics bits.

                S Offline
                S Offline
                sasadler
                wrote on last edited by
                #40

                I knew it is a stack oriented language, but never looked at it's keywords. I took a quick gander and it does look very forth like.

                1 Reply Last reply
                0
                • E englebart

                  You can already read this right to left. "=" is read as "is assigned to" not "equals". duh!

                  x = a + 12

                  Could be read as

                  12 added to a is assigned to x

                  Or left to right:

                  x is assigned a added to 12

                  Is your language going to support order of operations that follow neither direction?

                  N Offline
                  N Offline
                  Nikunj_Bhatt
                  wrote on last edited by
                  #41

                  englebart wrote:

                  x is assigned a added to 12

                  You wrote in English. It is like passive voice. Instead of "I have done this" you are writing "It has been done by me". If we write x = a + 12, it can be understood like this: (1) create a variable "x" (allocate memory), (2) add value of the variable "a" to 12 (store the sum somewhere in memory), (3) store the sum in variable "x". If we write a + 12 = x (OR a + 12 -> x), it can be understood like this: (1) add the value of variable "a" to 12 (store the sum somewhere in memory), (3) Create a variable "x" (allocate memory), (4) store the sum in variable "x". In the first approach, it is like - the system is allocating memory first without knowing the result. In the second approach, it is like - the system is first determining the result and then allocating memory according to the result. This second approach looks more logical way of executing and writing code. I think, the 1st approach is suitable to programming languages of .NET, C based, Java, etc. where variables needed to be defined before assigning values; while the 2nd approach is suitable for languages like JavaScript, PHP, etc. where variables can be defined/initialized anywhere in the code.

                  1 Reply Last reply
                  0
                  • M mischasan

                    Or use a good one, already invented. POP-2 - Wikipedia[^] With lambdas, managed mem, closures (full and partial), user-defined operators, user-defined setter functions, functions with multiple results, incremental compiler ... And with alternative ltr syntaxes: `f(a,b) ->x ->y` or `a; b.f() ->x ->y`

                    N Offline
                    N Offline
                    Nikunj_Bhatt
                    wrote on last edited by
                    #42

                    Wow! That's what I am talking about. It seems very much similar to my idea of a proper logical programming language. Thank you. :thumbsup:

                    1 Reply Last reply
                    0
                    • N Nikunj_Bhatt

                      Most of spoken languages are written LtR (Left-to-Right) but Maths, the number language, is actually written RtL because the decimal numbers are Arabic numerals. (I know, most will get surprised, but it's true about Maths RtL direction.) But somehow the RtL and LtR languages got mixed up. Instead of writing

                      x = a + 12

                      how about changing it to

                      a + 12 = x

                      So, what are your views on creating a new programming language which follows proper LtR execution? Is there already such language? (Please, just don't remind me that there are already lots of programming languages (I know already) and I must not (try to) create one more. :) )

                      G Offline
                      G Offline
                      Greg Lovekamp
                      wrote on last edited by
                      #43

                      In mathematical language, right-to-left or left-to-right is inconsequential pertaining to an equal sign due to complete commutativity law of equivalence.

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups