[HN Gopher] SSL: Stupid Stack Language
       ___________________________________________________________________
        
       SSL: Stupid Stack Language
        
       Author : max_
       Score  : 77 points
       Date   : 2021-03-13 10:04 UTC (12 hours ago)
        
 (HTM) web link (esolangs.org)
 (TXT) w3m dump (esolangs.org)
        
       | kwhitefoot wrote:
       | That's very interesting. Almost useful!
        
       | mikewarot wrote:
       | It is _possible_ to implement a real forth in this language.. but
       | it would be as slow as molasses in January. You can get the depth
       | of the stack, you can swap arbitrary positions of the stack, and
       | do math... so you could build a system of fixed allocation of
       | memory IN the stack, which means you could then compile new
       | definitions
       | 
       | The interpreter doesn't add like forth... it leaves the 2 values
       | to be added still on the stack... you have to do "glblb" to do a
       | normal add, for example.
       | 
       | A fun exercise, but not a language I'd want to work with.
       | 
       | Edit: Specifically missing are any ways to persist variables, or
       | allocate memory. Yes, you _could_ fake all of that with some very
       | careful coding, but a single mistake or clear stack (y) would
       | send it all tumbling down.
        
         | hansvm wrote:
         | > but a single mistake or clear stack (y) would send it all
         | tumbling down.
         | 
         | This seems especially prone to some kinds of nasty bugs if
         | you're not careful with what you're doing:
         | 
         | Would you like to save your progress? [y/n] >> y
        
       | lisper wrote:
       | Here's an interesting puzzle: is SSL Turing-complete? This is a
       | non-trivial question. On the one hand, it is known that single-
       | stack machines are not Turing-complete. On the other hand,
       | perhaps one of the SSL primitives is enough to make it Turing-
       | complete? If so, which one?
        
         | [deleted]
        
         | hansvm wrote:
         | Is that a puzzle you're posing that I shouldn't spoil, or are
         | you genuinely curious and interested in an answer here?
        
           | lisper wrote:
           | It's a puzzle. I know the answer.
        
       | high_byte wrote:
       | I'm pleasantly surprised, you actually meant it - it is stupid.
        
       | bumbledraven wrote:
       | Neat! SSL is similar to Forth and Slash/A in that any of them
       | could easily serve as the "DNA" of "organisms" in linear genetic
       | programming (a paradigm in which organisms are programs
       | represented as strings which evolve via mutation and crossover).
       | 
       | https://en.m.wikipedia.org/wiki/Linear_genetic_programming
        
         | siraben wrote:
         | I created an esolang in Mathematica to test out genetic
         | programming, by ruling out possibility of infinite looping,
         | implementing mutation and crossovers to result in a program
         | that would convert a list of numbers to a target number. Even a
         | naive implementation worked, which was pretty neat!
        
           | kwhitefoot wrote:
           | > ruling out possibility of infinite looping
           | 
           | How? No while loops? No backwards jumps? Or something clever?
           | :-)
        
             | siraben wrote:
             | No backward jumps. It was a language with a single register
             | (accumulator) and various arithmetic functions that would
             | let it advance a certain number of steps on the tape, or
             | add/multiply/subtract from the accumulator accordingly.
        
               | 7373737373 wrote:
               | Another approach would be to have a counter (or several)
               | that limit the number of instruction steps, like the
               | Stackless Python programming language (https://stackless.
               | readthedocs.io/en/latest/library/stackless...) or the
               | KeyKOS operating system
               | (https://github.com/void4/notes/issues/41) did
        
       | jqpabc123 wrote:
       | This is really more of a stack based virtual assembly language.
       | 
       | Obviously not the first nor the last. Lots of room for expansion
       | and syntax pre-compilers.
        
       | keyle wrote:
       | I love these languages, in a world of containers and yaml
       | warriors, they put back computing in computers.
        
         | siltpotato wrote:
         | What's a YAML warrior?
        
       | teddyh wrote:
       | See also: dc(1)
       | https://www.gnu.org/software/bc/manual/dc-1.05/html_mono/dc....
        
       | atrn wrote:
       | Reminds (old) me of WSFN -
       | https://en.wikipedia.org/wiki/WSFN_(programming_language)
        
       | Sniffnoy wrote:
       | This description doesn't explain how this correspondence between
       | 't's and 'u's is determined?
        
       | lifthrasiir wrote:
       | If I read the spec correctly, this is not necessarily Turing
       | complete because there is only one stack and the number is not
       | explicitly unbounded. (You can achieve TC with two stacks of
       | bounded numbers or one stack of unbounded numbers though.) In
       | particular JavaScript implementation uses an ordinary JS number,
       | which is essentially bounded. The original TC claim [1] seems
       | dependent to another language (Volatile) which uses explicitly
       | unbounded numbers.
       | 
       | [1]
       | https://esolangs.org/w/index.php?title=StupidStackLanguage&d...
        
         | asplake wrote:
         | Make it case-sensitive, case denoting which one of two stacks
         | to use?
         | 
         | Curious: Does that make the language easier to use in any way?
         | ("Easier" here being very relative of course)
        
           | alpaca128 wrote:
           | But wouldn't that require additional instructions to exchange
           | values between the two stacks? Otherwise you'd basically just
           | run two independent programs at the same time. In theory you
           | could just replace a single letter's functionality with "push
           | first element to other stack". v and w are redundant, for
           | example.
        
             | lifthrasiir wrote:
             | You can put only ones and zeros to two stacks and branch
             | against one stack to manipulate another stack. This is
             | enough for simulating a two-symbol tape and thus any TM
             | operating on that tape.
        
         | CJefferson wrote:
         | I assume the other way, if integers aren't limited, assume they
         | are unbounded. They are in the Python implementation.
         | 
         | If you start worrying about implementation bounds, C gets iffy
         | -- pointers have to have a known size, and be convertable to
         | and from integers, so you cant have unbounded memory in any
         | given implementation (you can get closer with files, but files
         | still have offsets which imply limited maximum size, and there
         | is a limited space of possible strings to name files).
        
           | lifthrasiir wrote:
           | You are correct. For this reason esolang community actually
           | has defined a related concept called bounded-storage machine
           | (BSM) [1]. C has a bounded memory but it can simulate an
           | arbitrary large BSM by increasing memory and thus pointer
           | size, so it is very close to (but not exactly) TC.
           | 
           | By comparison SSL has two axes of bounds (stack length bounds
           | and number bounds), only one of which is useful for
           | simulating an arbitrary large BSM. I would say it is also
           | close to TC but less so than C, because you need number
           | bounds proportional to the max memory of simulated BSM and it
           | is much easier to hit number bounds than stack length bounds.
           | 
           | [1] https://esolangs.org/wiki/Bounded-storage_machine
        
           | giomasce wrote:
           | That's true for any language. Computers are finite state
           | machines, though with a lot of states, therefore no actual
           | computer can really run a Turing complete language. As many
           | mathematical things, Turing completeness is an abstraction
           | that doesn't really map on reality without caveats.
        
       | e67f70028a46fba wrote:
       | I use a simple rpn calculator as a demo and motivation in many of
       | my classes. Stack languages are so neat.
        
         | danbst wrote:
         | do you have your class notes and exercises open? I too use RPN
         | calculator and stack machine as examples
        
       ___________________________________________________________________
       (page generated 2021-03-13 23:02 UTC)