ShapeScript
Length 6 snippet
"%c"@%
ShapeScript has no type casts, but Python's %
can be used to work around this limitation. This snippet, e.g., pops an integer from the stack and pushes the singleton string of the corresponding Unicode character in return.
Length 5 snippet
'"A"'
This is a string that, when evaluated, pushes the singleton string A on the stack. There is no way to escape a quote in ShapeScript, so two different kinds of quotes are required to use strings in evaluated strings.
Length 4 snippet
01-?
This calculates -1 and then pushes a copy (?
) of the bottom-most item on top of the stack. Since there are no variables, leaving things on the bottom to access them later is a common technique.
Length 3 snippet
123
Despite what it may look like, this actually pushes three integers on the stack. Any integer above 9 or below 0 has to be pushed as angebraic sum of products of integers.
Length 2 snippet
*!
With a Boolean and a string on the stack, *
pushes the unmodified string for True and and empty string for False, which !
then evaluates. This is the closest ShapeScript has to a conditional operator.
Length 1 snippet
!
Discounting that it can no longer take input, this is a fully compliant ShapeScript interpreter.
Factoid
I created ShapeScript as one half of my submission to Create a programming language that only appears to be unusableCreate a programming language that only appears to be unusable as a simple, stack-based language with a simple syntax.
While ShapeScript is far from unusable, it does not have traditional loops, conditionals or variables, can modify only the two topmost stack items, can modify strings only using split and join, etc.