Stories
Slash Boxes
Comments

SoylentNews is people

This page was generated by a Throng of Overworked Mongols for istartedi (123).
The Fine print: The following are owned by whoever posted them. We are not responsible for them in any way.

Journal by istartedi

The unfwics programming language (a hobby project I've been working on-and-off for years) has reached a point where I decided to give it a subversion repository. It's still private.

I just recently named it, and since like most such projects it's likely to remain esoteric I wanted a name that would be unique. Thus, Unique Name For Which I Can Search.

The name also fits with one of the key features of the language--the ability to mix prefix, postifx and infix freely. It's not prefix, postfix, or infix. It's "un-fix". Actual paste from command prompt:

+1 2
1+2
1 2 +
dump stack
#       0;  3
#       1;  3
#       2;  3

This works because where Lisp has an "eval" function, unfwics has in "infer" function which infers how the tokens should be re-ordered before interpretation. So far, it just seems to be slightly more complicated.

Aside from that, I'm aiming for it to be both interpreted and compiled, memory safe (it's currently reference counted), light-weight, and come with a translator to C that would allow it to run "unsafe" and fast (not even working on that yet). The current interpreter is incremental so in theory it could have "green" threads. I was inspired by reading about and studying Lisp, Forth, Erlang, Joy and probably a few others.

The Covid quarantine gave me a lot of time to work on this. If you hate this kind of thing, don't look at it. If you love odd new languages you'll have to wait a bit--it's still too full of stuff that's obviously wrong so I don't want to turn it loose; but just having a repository makes it feel a bit more real now. I haven't done any professional programming in 10 years so it feels funny to be committing again after all this time too...

Display Options Threshold/Breakthrough Save: Reply to Article Mark All as Read Mark All as Unread
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
(1)
  • (Score: 2, Insightful) by hendrikboom on Thursday July 09 2020, @10:56AM (12 children)

    by hendrikboom (1125) Neutral on Thursday July 09 2020, @10:56AM (#1018862) Homepage Journal

    Reminds me of a language a friend of mine designed a few years ago.
    A concatenative language like forth, but quite readable because the words were executed in reverse order, from right to left.
    Strings of such reverse-executable words could be separated by semicolons. Stuff written before a semicolon would be executed before the stuff after the semicolon. (this in the normal order, opposite to the words.
    Bunches of semocolon-separated strings could be collected within parentheses. Such a parenthisised expression would *not* automatically be executed, but would return a function that, if called, would execute the code inside it.
    And a character string would be a function that, when called with an argument, would loop, calling its argument with each character in turn.

    There was some use/mention notation that made it possible to use a function name to push the function onto the stack instead of executing it.

    And, oh yes, there were named values, and the names followed a static binding regime.

    Very minimal, and kind of fun.

    I wanted it to have static typing as well, but he didn't.

    • (Score: 2, Informative) by istartedi on Thursday July 09 2020, @12:08PM (11 children)

      by istartedi (123) on Thursday July 09 2020, @12:08PM (#1018897) Journal

      This is the kind of reply I was hoping for. Thank-you. I'm sitting here reading it and carefully considering each sentence, imagining what your friend's language was like. It's always interesting to read about these different concepts, even if you never write a line of code with it.

      --
      Appended to the end of comments you post. Max: 120 chars.
      • (Score: 1) by hendrikboom on Sunday July 12 2020, @07:46AM (6 children)

        by hendrikboom (1125) Neutral on Sunday July 12 2020, @07:46AM (#1019983) Homepage Journal

        Should I see if I can find a copy of the definition? (And permission to release it to you?)

        • (Score: 1) by hendrikboom on Sunday July 12 2020, @07:48AM

          by hendrikboom (1125) Neutral on Sunday July 12 2020, @07:48AM (#1019985) Homepage Journal

          Search will be difficult. I can't even remember what it was called.

        • (Score: 1) by istartedi on Sunday July 12 2020, @12:02PM (4 children)

          by istartedi (123) on Sunday July 12 2020, @12:02PM (#1020090) Journal

          No, that's OK. Don't make too much effort. I think I've got enough input and ideas from all the other languages out there. Your high level description is interesting enough. If the original author didn't decide to keep it available, I'm guessing they had reasons. OTOH, if it was on a a web site maybe it's still living in the Wayback Machine somewhere. That thing rocks... or at least it did. I've heard a lot of copyright holders have come out of the wood-work and it's got more bit-rot these days.

          --
          Appended to the end of comments you post. Max: 120 chars.
          • (Score: 1) by hendrikboom on Monday July 13 2020, @04:53AM (2 children)

            by hendrikboom (1125) Neutral on Monday July 13 2020, @04:53AM (#1020445) Homepage Journal

            It's something I should actually have on my file system *somewhere*. It's the kind of thing I would not delete. But finding it is another matter entirely.

            • (Score: 1) by istartedi on Monday July 13 2020, @06:59AM (1 child)

              by istartedi (123) on Monday July 13 2020, @06:59AM (#1020575) Journal

              If it's on a mountable file system you're doing better than I am. Somewhere around here I have an ST-225 20 meg hard drive [youtube.com] from the early 90s (not open like in the video). Every once in a while I think about how I'd go about spinning that bad-boy up and accessing the data. It's just got stupid e-mails from college on it, so no great loss. I'd probably just cringe at my own thoughts from 30 years ago, LOL. Oh, and then there was all my old C-64 assembly on floppies that I just sold and forgot about because, believe it or not, I was actually losing interest in the whole thing!

              --
              Appended to the end of comments you post. Max: 120 chars.
          • (Score: 1) by hendrikboom on Monday July 13 2020, @10:07AM

            by hendrikboom (1125) Neutral on Monday July 13 2020, @10:07AM (#1020765) Homepage Journal

            I had already written him when you said not to bother.
            The language is called Piglet, and he says "it's still a vaguely active toy/experiment".
            He's going to see if he can find a reasonably current description.

            I'm looking forward to seeing what he's come up with in the last decade or two.

            -- hendrik

      • (Score: 1) by hendrikboom on Monday July 13 2020, @11:22PM (3 children)

        by hendrikboom (1125) Neutral on Monday July 13 2020, @11:22PM (#1021152) Homepage Journal

        Stephen Spackman has come up with a link to the current description of Piglet.

        A Few Words about Piglet in 2020 [google.com]

        He mentioned in the email that it isn't all that definitive, but should give the flavour of the language.
        He recently (how recent I don't know) started on an implementation, but didn't finish either it or the language definition, getting bogged down in language tinkering.

        Apparently the google doc allows commenting by others; I haven't tried that yet, but I likely will. Haven't tried editing it out of respect for the original author's text; don't even know if I can.

        • (Score: 1) by istartedi on Tuesday July 14 2020, @04:47AM (2 children)

          by istartedi (123) on Tuesday July 14 2020, @04:47AM (#1021341) Journal

          Thanks. I just skimmed it for now. The most interesting thing yet is that quite surprisingly, unfwics handles the simple math example just like Piglet!

          + 2 3 + 4 5
          dump stack
          #       0;  5
          #       1;  9
          + 2 3; * 4
          dump stack
          #       0;  5
          #       1;  9
          #       2;  20

          In the first example, unfwics infers a prefix expression which causes it to evaluate everything to the right of +, then add. The 2 and 3, and everything to the right of them are inferred as postfix. 2 and 3 are pushed on the stack, and the second + is what actually adds them to result in 5. Then the 4 and 5 are pushed on the stack (because we are still chugging along in postfix). Finally, we're done processing the arguments to + in postfix and we execute the + resulting in 9. Thus, this expression got evaluated right to left even though no explicit effort was made to do that. A part of me would almost want to make it illegal since it's not the kind of prefix expression you'd use in Lisp. OTOH, I tend to lean in the direction of not hand-holding the programmer and allowing (though not encouraging) to write code that might be more difficult to analyze.

          The semicolon in unfwics is just a "virtual return". ie, it visually annotates the same impact as hitting return in a REPL, and yet once again it coincidently has the same result as Piglet!

          Maybe this springs from the fact that there are only so many ways to infer what a simple expression means. Reading down a bit further, of course the two language start to diverge wildly in what looks like quotation and lambdas. That part of Piglet reminds me a bit of Joy.

          --
          Appended to the end of comments you post. Max: 120 chars.
          • (Score: 1) by istartedi on Tuesday July 14 2020, @05:14AM (1 child)

            by istartedi (123) on Tuesday July 14 2020, @05:14AM (#1021358) Journal

            I may have misunderstood the way that he describes the state of the stack. He describes "4 f i s h" as the result of "trav «fish»" which implies that h was pushed first and 4 last. If that's true, then unfwics is *not* getting the same result as Piglet in the first example, because our conventions for describing the state of the stack are opposite.

            --
            Appended to the end of comments you post. Max: 120 chars.
            • (Score: 1) by hendrikboom on Tuesday July 14 2020, @08:11AM

              by hendrikboom (1125) Neutral on Tuesday July 14 2020, @08:11AM (#1021458) Homepage Journal

              That different stack display order tends to go with being a prefix language versus a postfix language. I tend to imagine the stack as being on the right, the active processing point in the middle (and this the stack top immediately to its right, and the currently bound variables on the left.

  • (Score: 2, Informative) by Mojibake Tengu on Thursday July 09 2020, @03:09PM (3 children)

    by Mojibake Tengu (8598) Neutral on Thursday July 09 2020, @03:09PM (#1018944) Journal

    You seem be in process of reinventing what in more civilized math schools was originally known as Łukasiewicz notation.

    Historically, the polish mathematician Jan Łukasiewicz invented lot of stuff based on ternary logic, included a semantics interpretation based on ternary logic. Any semantics interpretation based on some logic is what makes programming languages practically usable.
    Later, some of those ideas were stolen by Kleene and other functionalists and for the pure evil purpose of not mentioning Łukasiewicz at all in their papers, the decadent anglosphere math school started to call this just a polish notation. What a shame!

    But, this is exactly where so called reverse polish notation, known as RPN, famously known from calculators, Forth langue and other similar languages originally came from.
    Technically, a reverse-executable Forth-like language would be just a Łukasiewicz notation.

    I suggest you better have a separator between + and 1, otherwise you'll run into ambiguity with more complex composite syntax.

    Also, it may be interesting for you to have a look on APL and Iverson bracket (which is technically a generalised Kronecker delta of operator calculus).

    https://en.wikipedia.org/wiki/Jan_%C5%81ukasiewicz [wikipedia.org]
    https://en.wikipedia.org/wiki/Polish_notation [wikipedia.org]
    https://en.wikipedia.org/wiki/APL_(programming_language) [wikipedia.org]
    https://en.wikipedia.org/wiki/Iverson_bracket [wikipedia.org]

    --
    The edge of 太玄 cannot be defined, for it is beyond every aspect of design
    • (Score: 1) by istartedi on Thursday July 09 2020, @06:54PM (1 child)

      by istartedi (123) on Thursday July 09 2020, @06:54PM (#1018982) Journal

      Interesting links. Thanks.

      I suggest you better have a separator between + and 1, otherwise you'll run into ambiguity with more complex composite syntax.

      I'm not seeing any potential problem with that. The minus-sign, OTOH, is a real PiTA because it can represent the first part of a negative constant, binary subtraction, or the unary negation operator. I only have the first two so far, and may just punt the unary negation operator in favor of a "neg" function that serves as the counterpart to "abs".

      I've heard of APL, and the notion of a special character set and very terse languages isn't a direction in which I care to go. I'm also not a big fan of regex.

      --
      Appended to the end of comments you post. Max: 120 chars.
      • (Score: 1) by Mojibake Tengu on Thursday July 09 2020, @08:47PM

        by Mojibake Tengu (8598) Neutral on Thursday July 09 2020, @08:47PM (#1018996) Journal

        I understand your meaning of abs is "force positive" and meaning of neg is "force negative".

        But you can use just unary "sign flip" operator instead of prefix minus, usually denoted with +/- symbol on calculators, as well as in several stack oriented languages.
        Sign flip operation itself has a good meaning in geometry of classic number sets, it's a symmetry and it is free from inner conditions (unlike abs and neg). That means, it is usually simpler and faster to implement by machine instructions or language primitive routines.

        That leaves a simple "-" symbol dedicable for a binary operation only.

        --
        The edge of 太玄 cannot be defined, for it is beyond every aspect of design
    • (Score: 1) by hendrikboom on Monday July 13 2020, @10:11AM

      by hendrikboom (1125) Neutral on Monday July 13 2020, @10:11AM (#1020770) Homepage Journal

      Maybe they called it Polish because they couldn't pronounce or spell "Łukasiewicz", even though it has nothing to do with keeping furniture shiny.

      Just line the van Wijgaarden grammars used in the Algol 68 definition ended up being called two-level grammars of VW grammars, although they have nothing to do with German cars.

      "Wijngaarden" contains four sounds that do not occur in English.

      -- hendrik

  • (Score: 1) by Bot on Saturday July 11 2020, @06:09PM

    by Bot (3902) Neutral on Saturday July 11 2020, @06:09PM (#1019749) Journal

    it seem designed to foster disagreements on style. INTERCAL move over :D

    --
    Account abandoned.
  • (Score: 1) by istartedi on Friday October 16 2020, @05:56AM

    by istartedi (123) on Friday October 16 2020, @05:56AM (#1065504) Journal

    Since setting up the repository in early July, I have committed the 200th revision today. Still too many issues to release...

    --
    Appended to the end of comments you post. Max: 120 chars.
(1)