Data update
This commit is contained in:
parent
796d366b97
commit
35bcdeebf8
504 changed files with 7045 additions and 610 deletions
|
|
@ -0,0 +1,62 @@
|
|||
/* this need data into stack */
|
||||
#context Multiplication
|
||||
mul
|
||||
Return \\
|
||||
#synon Multiplication *getproduct
|
||||
|
||||
#context-free anothermul
|
||||
/* #defn Args(*) #GENCODE $$$*$$$ #REVLIST=0,mov(#REVLIST);#ENDGEN, */
|
||||
Args 'a,b'
|
||||
Return ( #(a*b) )\\
|
||||
#synon anothermul *getanotherproduct
|
||||
|
||||
#include <jambo.h>
|
||||
|
||||
#prototype _multiply(_X_,_Y_)
|
||||
#synon __multiply Multiply
|
||||
|
||||
Main
|
||||
/* "prototipos" of functions and procedures.
|
||||
Solves internaly */
|
||||
Printnl ( Multiply ( 10, 4 ) )
|
||||
Printnl ( __multiply ( 10, 4 ) )
|
||||
|
||||
/* definición alternativa 1 */
|
||||
Printnl ( Set' 10,4 ', Gosub ' Multiply2 ')
|
||||
|
||||
/* aseembler Hopper 1 */
|
||||
{10,4} jsub( Multiply3 ), {"\n"} print
|
||||
|
||||
/* assembler Hopper 2 */
|
||||
{10,4} jsub( Multiply4 ), {"\n"} print
|
||||
|
||||
/* context */
|
||||
Set '10,4', now get product, and print with newline
|
||||
|
||||
/* context-free */
|
||||
Set '10,4', and get another product; then print with newline
|
||||
|
||||
End
|
||||
|
||||
.locals /* Subrutines */
|
||||
|
||||
_multiply(a,b)
|
||||
Return ( Mul(a,b) )
|
||||
|
||||
/* Define is macro. Others macros: Function, Procedure:
|
||||
#defn Define(_F_,*) _F_:,#GENCODE $$$*$$$ #REVLIST=0;mov(#REVLIST);#ENDGEN;
|
||||
#defn Function(_F_,*) _F_:,#GENCODE $$$*$$$ #REVLIST=0;mov(#REVLIST);#ENDGEN;
|
||||
#defn Procedure(_F_,*) _F_:,#GENCODE $$$*$$$ #REVLIST=0;mov(#REVLIST);#ENDGEN;
|
||||
*/
|
||||
Define 'Multiply2, a,b'
|
||||
Return ( Mul(a,b) )
|
||||
|
||||
Multiply3:
|
||||
b=0, mov(b), a=0, mov(a)
|
||||
{a,b}mul /* result into stack */
|
||||
Return
|
||||
|
||||
Multiply4:
|
||||
mul /* get values from stack,
|
||||
and put result into stack */
|
||||
back /* Return */
|
||||
|
|
@ -1 +1 @@
|
|||
symbol f := (x,y => x * y);
|
||||
symbol f = (x,y => x * y);
|
||||
|
|
|
|||
8
Task/Function-definition/Zig/function-definition.zig
Normal file
8
Task/Function-definition/Zig/function-definition.zig
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
fun multiply(x: i64, y: i64) i64 {
|
||||
return x * y;
|
||||
}
|
||||
|
||||
//example call
|
||||
const x: i64 = 4;
|
||||
const y: i64 = 23;
|
||||
_ = multipy(x, y); // --> 93
|
||||
Loading…
Add table
Add a link
Reference in a new issue