proj-plbook-plChOtherParadigmsLangs

Table of Contents for Programming Languages: a survey

Shell

Best practices and style guides:

Bash Shell

Best practices and style guides:

Tutorials:

Best practices:

Frameworks:

Powershell

https://msdn.microsoft.com/powershell

"abstracting gorp into high level task oriented abstractions, object pipelines, structured data, and the workflow from interactive shells to ad hoc scripts to formal scripts to production scripting." -- a powershell designer

Features:

Tutorials:

Retrospectives:

Opinions:

Code:

Scheme shell

Turtle shell (Haskell)

Tcl

Fish shell

https://fishshell.com/

Oil shell

https://www.oilshell.org

Combinatorial

Nock

Hoon

Links:

Concatenative

A concatenative programming language is a point-free language in which all expressions are functions, and the concatenation of two programs denotes the composition of the functions denoted by the two programs. -- paraphrasing https://en.wikipedia.org/wiki/Concatenative_programming_language and http://web.archive.org/web/20111007025556/http://www.latrobe.edu.au/phimvt/joy/j02maf.html

Forth

opinions

primitives

" Appendix B A Glossary of Forth Primitives

The Forth language is based on an extensible, interactive compiler that creates code for a virtual stack machine. The virtual machine has two stacks. The Data Stack is used for expression evaluation and subroutine parameter passing. The Return Stack is used for subroutine return address saving and for loop control variable storage. The source code for Forth directly reflects the underlying stack machine, and so uses Reverse Polish Notation (RPN) to perform all operations using.

Forth programs are built as a hierarchy of subroutines. Each subroutine is called a "word" in Forth terminology. A program consists of a single Forth word which calls several other Forth words, and so on, forming a tree-structured program. At the lowest level, the leaves of the tree are invocations of Forth primitive words that manipulate the stacks and perform arithmetic.

Below is a glossary of the Forth primitive words found on stack machines discussed in this book. Most of these primitives are actually applicable to any program written in any language on a stack machine (for example, addition of the top two stack elements or swapping the order of the top two stack elements). Forth nomenclature is used in discussions to maintain consistency with an existing standard vocabulary for stack machine operation.

Each Forth word is followed by a "stack picture" on the same line. This stack picture shows the input parameters and output parameters on the Forth Data Stack for the word being described. The values on the left of the "_" indicate the input parameters while those to the right of the "_" indicate output parameters. Each parameter list is ordered with the topmost stack element to the right. Notation in the stack lists is as follows: N1, N2, N3, etc. indicate single-precision integers. D1, D2, etc. indicate double-precision integers, which take up two elements on the data stack. ADDR indicates an address, which may be thought of as a pointer value. FLAG is an integer which is false if zero, true if non-zero. A more detailed glossary of Forth is Haydon's All About Forth (1983).

0 - 0 Push the integer 0 onto the stack.

0< N1 - FLAG Return a true FLAG if N1 is negative.

0= N1 - FLAG Return a true FLAG if N1 is zero.

0 N1 - FLAG Return a true FLAG if N1 is greater than zero.

0BRANCH N1 - If N1 is false (value is 0) perform a branch to the address in the next program cell, otherwise continue.

1+ N1 - N2 Add one to N1, returning N2.

1- N1 - N2 Subtract one from N1, returning N2.

2+ N1 - N2 Add two to N1, returning N2.

2* N1 - N2 Multiply N1 by two, returning N2.

2/ N1 - N2 Divide N1 by two, returning N2.

4+ N1 - N2 Add four to N1, returning N2.

< N1 N2 - FLAG Return a true FLAG if N1 is less than N2.

<> N1 N2 - FLAG Return a true FLAG if N1 is not equal to N2.

N1 N2 - FLAG

Return a true FLAG if N1 equals N2.

R N1 - Push N1 onto the return stack.

> N1 N2 - FLAG Return a true FLAG if N1 is greater than N2.

! N1 ADDR - Store N1 at location ADDR in program memory.

+ N1 N2 - N3 Add N1 and N2, giving sum N3.

+! N1 ADDR - Add N1 to the value pointed to by ADDR.

- Define the start of a subroutine. The primitive [CALL] is compiled every time this subroutine is reference by other definitions.

; - Perform a subroutine return and end the definition of a subroutine. The primitive [EXIT] is compiled.

?DUP N1 - N1 N1 ( if N1 non-zero ) N1 - N1 ( if N1 is zero ) Conditionally duplicate the input N1 if it is non-zero.

@ ADDR - N1< Fetch the value at location ADDR in program memory, returning N1.

ABS N1 - N2 Take the absolute value of N1 and return the result N2.

AND N1 N2 - N3 Perform a bitwise AND on N1 and N2, giving result N3.

BRANCH - Perform an unconditional branch to the compiled in-line address.

D! D1 ADDR - Store the double-precision value D1 at the two memory words starting at ADDR.

D+ D1 D2 - D3 Return the double precision sum of D1 and D2 as D3.

D@ ADDR - D1 Fetch the double precision value D1 from memory starting at address ADDR.

DDROP D1 - Drop the double-precision integer D1.

DDUP D1 - D1 D1 Duplicate D1 on the stack.

DNEGATE D1 - D2 Return D2, which is the two's complement of D1.

DROP N1 - Drop N1 from the stack.

DSWAP D1 D2 - D2 D1 Swap the top two double-precision numbers on the stack.

DUP N1 - N1 N1 Duplicate N1, returning a second copy of it on the stack.

I - N1 Return the index of the currently active loop.

I' - N1 Return the limit of the currently active loop.

J - N1 Return the index of the outer loop in a nested loop structure.

LEAVE - Set the loop counter on the return stack equal to the loop limit to force an exit from the loop.

LIT - N1 Treat the compiled in-line value as an integer constant, and push it onto the stack as N1.

NEGATE N1 - N2 Return N2, which is the two's complement of N1 NOP - Do nothing.

NOT FLAG1 - FLAG2 Synonym for 0=. Takes the inverse of a flag value.

OR N1 N2 - N3 Perform a bitwise OR on N1 and N2, giving result N3.

OVER N1 N2 - N1 N2 N1 Push a copy of the second element on the stack, N1, onto the top of the stack.

PICK ... N1 - ... N2 Copy the N1'th element deep in the data stack to the top. In Forth-83, 0 PICK is equivalent to DUP , and 1 PICK is equivalent to OVER .

R> - N1 Pop the top element of the return stack, and push it onto the data stack as N1.

R@ - N1 Copy the top Return Stack word N1 onto the Data Stack.

ROLL ... N1 - ... N2 Pull the N1'th element deep in the data stack to the top, closing the hole left in the stack. In Forth-83, 1 ROLL is equivalent to SWAP , and 2 ROLL is equivalent to ROT.

ROT N1 N2 N3 - N2 N3 N1 Pull the third element down in the stack onto the top of the stack.

S-D N1 - D2 Sign extend N1 to occupy two words, making it a double precision integer D2.

SWAP N1 N2 - N2 N1 Swap the order of the top two stack elements.

U< U1 U2 - FLAG Return a true FLAG if U1 is less than U2 when compared as unsigned integers.

U U1 U2 - FLAG Return a true FLAG if U1 is greater than U2 when compared as unsigned integers.

U* N1 N2 - D3 Perform unsigned integer multiplication on N1 and N2, yielding the unsigned double precision result D3.

U/MOD D1 N2 - N3 N4 Perform unsigned integer division on D1 and N2, yielding the quotient N4 and the remainder N3.

XOR N1 N2 - N3 Perform a bitwise exclusive OR on N1 and N2, giving result N3.

" -- http://users.ece.cmu.edu/~koopman/stack_computers/appb.html

LITERAL LEAVE KEY? KEY J INVERT INCLUDED INCLUDE-FILE IMMEDIATE IF I HOLD HEX HERE GET-ORDER GET-CURRENT F~ FVARIABLE FTANH FTAN FSWAP FSQRT FSINH FSINCOS FSIN FS. FROUND FROT FREE FOVER FORTH-WORDLIST FORTH FNEGATE FMIN FMAX FM/MOD FLUSH-FILE FLOOR FLOG FLOATS FLOAT+ FLNP1 FLN FLITERAL FIND FILL FILE-STATUS FILE-SIZE FILE-POSITION FEXPM1 FEXP FE. FDUP FDROP FDEPTH FCOSH FCOS FCONSTANT FATANH FATAN2 FATAN FASINH FASIN FALSE FALOG FALIGNED FALIGN FACOSH FACOS FABS F@ F>D F< F0= F0< F/ F. F- F+ F F* F! EXIT EXECUTE EVALUATE ERASE ENVIRONMENT? ENDOF ENDCASE EMIT ELSE EKEY? EKEY>CHAR EKEY DUP DUMP DU< DROP DOES> DO DNEGATE DMIN DMAX DFLOATS DFLOAT+ DFALIGNED DFALIGN DF@ DF! DEPTH DELETE-FILE DEFINITIONS DECIMAL DABS D>S D>F D= D< D2/ D2* D0= D0< D.R D. D- D+ CS-ROLL CS-PICK CREATE-FILE CREATE CR COUNT CONSTANT COMPILE, COMPARE CODE CMOVE> CMOVE CLOSE-FILE CHARS CHAR+ CHAR CELLS CELL+ CATCH CASE C@ C, C" C! BYE BLOCK BLK BLANK BL BIN BEGIN BASE AT-XY ASSEMBLER AND ALSO ALLOT ALLOCATE ALIGNED ALIGN AHEAD AGAIN ACCEPT ABS ABORT" ABORT @ ?DUP ?DO ? >R >NUMBER >IN >FLOAT >BODY > = <> <# < ;CODE ; :NONAME : 2VARIABLE 2SWAP 2ROT 2R@ 2R> 2OVER 2LITERAL 2DUP 2DROP 2CONSTANT 2@ 2>R 2/ 2* 2! 1- 1+ 0> 0= 0<> 0< /STRING /MOD / .S .R .( ." . -TRAILING - , +LOOP +! + */MOD */ * (LOCAL) ( ' #S #> # ! ok

another set of core words ('base words') (section 'noop' through 'hack'): https://github.com/jamesbowman/swapforth/blob/master/j1a/basewords.fs

Opinions:

Implementations:

Retrospectives:

Tutorials and books:

Joy

Retrospectives:

Variants/implementations:

Links:

Cat

Kitten

http://kittenlang.org/

https://github.com/evincarofautumn/kitten

Factor

http://factorcode.org/

Opinions:

Tutorials:

Stacker

Stacker is a toy Forth-like language invented to demonstrate LLVM.

Its built-in words are (quoting from http://llvm.org/releases/1.1/docs/Stacker.html#lexicon ):

Logical: These words provide the logical operations for comparing stack operands. The words are: < > <= >= = <> true false.

Bitwise: These words perform bitwise computations on their operands. The words are: 1 XOR AND NOT

Arithmetic: These words perform arithmetic computations on their operands. The words are: ABS NEG + - * / MOD */ ++ -- MIN MAX

Stack: These words manipulate the stack directly by moving its elements around. The words are: DROP DUP SWAP OVER ROT DUP2 DROP2 PICK TUCK

Memory: These words allocate, free, and manipulate memory areas outside the stack. The words are: MALLOC FREE GET PUT

Control: These words alter the normal left to right flow of execution. The words are: IF ELSE ENDIF WHILE END RETURN EXIT RECURSE

I/O: These words perform output on the standard output and input on the standard input. No other I/O is possible in Stacker. The words are: SPACE TAB CR >s >d >c <s <d <c.

DSSP

A Forth-like language, notable for being the language of the Setun ternary computer. A comparison between Forth and DSSP, and the motivation of the differences, may be found at Sidorov and Shumakov. DSSP and Forth. Compare Analysis.


Probabalistic

https://en.wikipedia.org/wiki/Probabilistic_programming_language


Eve

important properties of Eve

"

If you go back and watch the original Light Table videos and compare them to the Eve post, you'll see a lot of similarities. No state is ever hidden. The inspector shows you not just related bits of code, but the specific blocks that affect the things on screen. The document can be reconfigured into only the parts you care about. You can evaluate code in a running program. Anything can be visualized...

It took a lot to gain those properties, from designing a language that doesn't depend on order to ensuring that we don't throw away information as we parse and analyze the code you've written. As we built the later versions of Light Table, even doing something as simple as eval in Javascript and Python had numerous caveats and strange edge cases. Eve doesn't have these issues. It was designed from the ground up to support the principles that Light Table was founded on and then expand them into a more cohesive view on programming.

" -- [22]

"From a technical standpoint, Eve is a variant of Datalog, which means that it's a database as much as it is a general purpose programming language." -- [23]

"Eve's language runtime includes a parser, a compiler, an incremental fixpointer, database indexes, and a full relational query engine with joins, negation, ordered choices, and aggregates. You might expect such a thing would amount to 10s or maybe 100s of thousands of lines of code, but our entire runtime is currently ~6500 lines of code. That's about 10% the size of React's source folder. :)" -- [24]

---

anti-goals of Eve:

" somethings that Eve won't be good at any time soon, if ever:

---

application domains at Eve:

" From a technical standpoint, Eve is a variant of Datalog, which means that it's a database as much as it is a general purpose programming language. Being explicitly designed for data transformation, there are somethings that Eve will particularly excel at:


Languages for embedding

http://www.clifford.at/embedvm/

Reduceron


Footnotes:

1.