DefLang Wiki
DefLang wiki.
(sorry i am japanese,this wiki is using not good english...)
DefLang(DEFL) Wiki
Wiki commands list
- How to run file
- Commands
- Basic
- echo
- def
- vew(Deleted.)
- Variable
- calc
- rettofir
- out
- geturl
- preload
- sleep
- functions
- for loop
- drawline
- fillrect
- fillarc
- genimg
- if
- goto
- Define function
How to Run File
First,Write This in NodeJS.
var defl=require('deflang') var res=defl(`program main; echo:program test!; end program`) console.log(res) //Display : program test!
If you want use it in Vanilla JS then load vanilla/index.js.
<script> rundefl(`program main;\n echo:test;\n end program`,callback=>{ console.log(callback) }) </script> <script src='vanilla/index.js'></script> <!-- or <script src='https://cdn.jsdelivr.net/npm/[email protected]/vanilla/index.js'></script> -->
Commands
0. Basic
DefLang have a rule.
Rules 1.Write Semicolon(;) on all commands final. 2.Split string is colon(:) 3.Its have a three can escape string. 1.AND(&&) 2.Semicolon(&;) 3.Colon(&:) 4.Dont use й and ⍝ and ы.Them are Control String. 5.Write program in program main; ~ end program
1. echo
echo:[message];
Run this script to display [message].
2. def
def:[variable name]:[content]:[mode];
Run this to define [variable name] and set content to [content]
If [mode] == file then,define [variable name] and set file content to [content].
If [mode] == calc then,define [variable name] and set calculated answer to [content].
If [mode] == array then,define [variable name] and set array.format is down :
first value,second value,third value,11,22,10
If [mode] == object then,define [variable name] and set object.format is down :
key=value,name=value,number=1,data1=10
Array can access by {[array name].[number]}
3. vew(Deleted.If you want use vew,install 1.2.0 from website.)
vew:[variable name];
Run this script to display [variable name] content.
If undefined variable,Its return UNDEFINED ERROR and stop script.
4. Variable
%[variable name]%
Run this script to Access to [variable name].
5. calc
calc:[formula];
Run this script to Display to Calculated [formula].
6. rettofir
rettofir;
Run this script to Loop script.
7. out
out:[filename]:[content];
Write [content] to [filename]
8. geturl
geturl:[url]:[filename];
get content from [url] and write content to [filename].
9. preload
preload:[filename]
load content from [filename] and define variables.
format is key:value;
preload file example :
test:hoge;test2:fuga;
10. sleep
Note,sleep command use CPU,dont use long time
sleep:[seconds];
sleep [seconds].
11. functions
echo:sin(123); echo:cos(123): echo:tan(123); echo:deg2rad(360); echo:rad2deg(6.28);
DefLang have five math functions.
12. for loop
for:[variable name]:[start value]:[end value]; {commands} next;
for command loop not forever.
for command can select loop number.
13. drawline
drawline:[x1]:[y1]:[x2]:[y2]:[color];
draw line.
14. fillrect
fillrect:[x]:[y]:[width]:[height]:[color];
draw filled rect.
15. fillarc
fillarc:[x]:[y]:[radius]:[color]:[start angle]:[end angle];
draw filled circle.
16. genimg
genimg:[filename];
Generate PNG File [filename].
([filename] is without .png)
17. if
if:[value1]:[mode]:[value2]:[line];
Mode can select ==,!=,>=,<=,>,<.
line count from first command.
18. goto
goto:[line number];
Go to [line number].
line count from first command.
19. Define function
#function begin{ [DefLang program] }end name:arg1:arg2...;
Define function.
You can get arguments from variable “argv”.