Difference between revisions of "REFAL"
Jump to navigation
Jump to search
SwissChili (talk | contribs) (Created page with "REFAL (Wikipedia) is a functional programming language designed around the idea of pattern matching. It was designed by Valentin Turchin in 1966 and first implemented in 1968. This Wiki holds documentation for my implementation of REFAL. More information about how/why I wrote it is available on my [https://swisschili.sh/a-refal-interpreter/ website]. The interpreter is written in C++ and available on [https://github.com/swissChili/REFAL Github]. Onc...") |
SwissChili (talk | contribs) (Add standard functions) |
||
Line 3: | Line 3: | ||
This Wiki holds documentation for my implementation of REFAL. More information about how/why I wrote it is available on my [https://swisschili.sh/a-refal-interpreter/ website]. The interpreter is written in C++ and available on [https://github.com/swissChili/REFAL Github]. | This Wiki holds documentation for my implementation of REFAL. More information about how/why I wrote it is available on my [https://swisschili.sh/a-refal-interpreter/ website]. The interpreter is written in C++ and available on [https://github.com/swissChili/REFAL Github]. | ||
== Syntax == | |||
TODO | |||
== Built-in Functions == | |||
These functions are pre-loaded into REFAL and can be used at any time. They are not identical to standard REFAL-5 functions: some changes have been made for simplicity's sake. | |||
=== Input & Output Functions === | |||
* <code><Print e.Expr></code> Prints the expression to standard output. Returns <code>e.Expr</code>. | |||
* <code><Prout e.Expr></code> Prints the expression to standard output. Returns an empty expression. | |||
=== Stack (variable) Manipulation Functions === | |||
* <code><nowiki><Br s.Name '=' e.Value></nowiki></code> Pushes the variable <code>s.Name</code> onto the stack with the value <code>e.Value</code> | |||
* <code><Dg s.Name></code> "Digs" (pops) the variable <code>s.Name</code> off the stack. Returns the value associated with <code>s.Name</code> | |||
* <code><Cp s.Name></code> Copies the variable <code>s.Name</code>, returns value associated with <code>s.Name</code>. Unlike <code><Dg></code> this does not remove the variable from the stack. |
Revision as of 04:27, 21 February 2022
REFAL (Wikipedia) is a functional programming language designed around the idea of pattern matching. It was designed by Valentin Turchin in 1966 and first implemented in 1968.
This Wiki holds documentation for my implementation of REFAL. More information about how/why I wrote it is available on my website. The interpreter is written in C++ and available on Github.
Syntax
TODO
Built-in Functions
These functions are pre-loaded into REFAL and can be used at any time. They are not identical to standard REFAL-5 functions: some changes have been made for simplicity's sake.
Input & Output Functions
<Print e.Expr>
Prints the expression to standard output. Returnse.Expr
.<Prout e.Expr>
Prints the expression to standard output. Returns an empty expression.
Stack (variable) Manipulation Functions
<Br s.Name '=' e.Value>
Pushes the variables.Name
onto the stack with the valuee.Value
<Dg s.Name>
"Digs" (pops) the variables.Name
off the stack. Returns the value associated withs.Name
<Cp s.Name>
Copies the variables.Name
, returns value associated withs.Name
. Unlike<Dg>
this does not remove the variable from the stack.