# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0.  If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# Copyright 1997 - July 2008 CWI, August 2008 - 2016 MonetDB B.V.

module language;

pattern call(s:str):void
address CMDcallString
comment "Evaluate a MAL string program.";
pattern call(m:str,f:str):void
address CMDcallFunction;
pattern call(s:bat[:str]):void
address CMDcallBAT
comment "Evaluate a program stored in a BAT.";
pattern source(f:str):void
address CMDevalFile
comment "Merge the instructions stored in the file with the current program.";

command raise(msg:str) :str 
address CMDraise
comment "Raise an exception labeled 
	with a specific message.";
command assert(v:bit,term:str):void
address MALassertBit;
command assert(v:sht,term:str):void
address MALassertSht;
command assert(v:int,term:str):void
address MALassertInt;
command assert(v:lng,term:str):void
address MALassertLng;
command assert(v:str,term:str):void
address MALassertStr;
command assert(v:oid,term:str):void
address MALassertOid;
pattern assert(v:any_1,pname:str,oper:str,val:any_2):void
address MALassertTriple
comment "Assertion test.";

pattern dataflow():bit
address MALstartDataflow
comment "The current guarded block is executed using dataflow control. ";

pattern sink(v:any...):void
address MALgarbagesink
comment "Variables to be considered together when triggering garbage collection.
Used in the dataflow blocks to avoid early release of values.";

pattern pass(v:any_1)
address MALpass
comment "Cheap instruction to disgard storage while retaining the dataflow dependency";

pattern block(v:int,w:any...):int
address deblockdataflow
comment "Block on availability of all variables w, and then pass on v";

pattern register(m:str,f:str,code:str,help:str):void
address CMDregisterFunction
comment"Compile the code string to MAL and register it as a function.";
