[fish]Fish-lang

Fish-lang is a function-based, customizable syntax of programming languages.

Why design fish this language

The current programming language syntax are fixed dead, it can not be easily removed syntax. fish all language grammar function is defined by the language provides only define a function / procedure calls.

Language syntax fish

print if a b c

If the function is a result of the true output function b, or c of the output functions.

loop a b

Cycle call function b, the return value of a function of time.

Of course, the above appearing loop, if, print and other functions for system functions, we can u unregister a way to cancel the registration function.

We can look at a more complex code.

print if a b c d e

We break down what this code.

Code reverse stack from the top in the end portion of print, if, a, b, c, d, e
Virtual Machine calls the print function, a parameter needs to print, the stack IF,
IF requires three parameters, a, b, c the stack.
A run, a need to assume a parameter d stack,
operation d, d is assumed without any parameter, to write true exa,
IF exa as is found true, stack b, C abandoned,
operation b, assuming a required parameter b , e stack,
operation e, e is assumed without parameters, a write address to the string hello world exa,
Print exa point is found hello world, hello world output.

Guess you like

Origin www.cnblogs.com/jhy16193335/p/11884694.html