Learn about our RFC process, Open RFC meetings & more.Join in the discussion! »

deflang

3.9.138 • Public • Published

DefLang(DEFL) Wiki


This is DEFL Wiki.

Wiki commands list

  1. How to run file
  2. Commands
    0. Basic
    1. echo
    2. def
    3. vew(Deleted.)
    4. Variable
    5. calc
    6. rettofir
    7. out
    8. geturl
    9. preload
    10. sleep
    11. functions
    12. for loop
    13. drawline
    14. fillrect
    15. fillarc
    16. genimg
    17. if
    18. goto
    19. 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;
echo:test;
end program`,callback=>{
console.log(callback)
})
</script> 
<script src='vanilla/index.js'></script>
<!--
  or <script src='https://cdn.jsdelivr.net/npm/deflang@latest/vanilla/index.js'></script>
-->

If you want run DefLang by cli then do this.

cd node_modules/deflang
npm link
defl [filename]

## Commands

### 0. Basic These are some basic rules for DefLang.

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.Don't use U+F000 and U+F001 and U+F002 and U+F003.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

Arrays can be accessed by {[array name].[number]}

If [mode] == input then, define [variable name] and display [content] and ask to user.

### 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 the variable is undefined, UNDEFINED ERROR will return and stop the script.

### 4. Variable

%[variable name]%

Run this script to access [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 <name> begin{
[DefLang program]
}end
name:arg1:arg2...;

Define function.
You can get arguments from variable “argv”.


Changelog

3.9.131: Added Changelog and ToDo And fixed english(Thanks rediar!)

3.9.132: Fixed README.md

3.9.133: Fixed README.md

3.9.134: Fixed README.md

3.9.135: Fixed README.md

3.9.136: Supports Indent

3.9.137: Supports Double Quotation and Single Quotation

3.9.138: Fixed Program


ToDo

  • More Data Types
  • Command for call other DefLang program
  • Command for HTTP(S) Request

Install

npm i deflang

DownloadsWeekly Downloads

7

Version

3.9.138

License

CC-BY-ND

Unpacked Size

29.9 kB

Total Files

25

Last publish

Collaborators

  • avatar