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 cookbook link) |
||
(2 intermediate revisions by the same user not shown) | |||
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]. | ||
== Learn REFAL == | |||
There are a few good resources on REFAL for beginners available online: | |||
* The REFAL book by Valentin F. Turchin (inventor of REFAL), in [http://refal.botik.ru/book/html/ English] and [http://refal.net/rf5_frm.htm Russian]. | |||
*The (work in progress) [[REFAL/Cookbook|REFAL Cookbook]] written by me (and maybe in the future, contributors). | |||
== 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. |
Latest revision as of 00:26, 16 April 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.
Learn REFAL
There are a few good resources on REFAL for beginners available online:
- The REFAL book by Valentin F. Turchin (inventor of REFAL), in English and Russian.
- The (work in progress) REFAL Cookbook written by me (and maybe in the future, contributors).
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.