mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 17:50:22 +00:00
Added:
* DM (Dream Maker) language. * Sample DM file. The DM language is used in an engine known as BYOND which allows users to easily create their own games in a language that is designed to be accessible for newcomers. I do not know how much a language has to be used on the site to be considered but searching for "BYOND" does show a lot of people using the language. I am also still learning git so if I have missed something then please let me know.
This commit is contained in:
@@ -344,6 +344,14 @@ DCPU-16 ASM:
|
|||||||
Diff:
|
Diff:
|
||||||
primary_extension: .diff
|
primary_extension: .diff
|
||||||
|
|
||||||
|
DM:
|
||||||
|
type: programming
|
||||||
|
color: "#075ff1"
|
||||||
|
primary_extension: .dm
|
||||||
|
aliases:
|
||||||
|
- byond
|
||||||
|
|
||||||
|
|
||||||
Dylan:
|
Dylan:
|
||||||
type: programming
|
type: programming
|
||||||
color: "#3ebc27"
|
color: "#3ebc27"
|
||||||
|
|||||||
79
samples/DM/example.dm
Normal file
79
samples/DM/example.dm
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
// This is a single line comment.
|
||||||
|
/*
|
||||||
|
This is a multi-line comment
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Pre-processor keywords
|
||||||
|
|
||||||
|
#define PI 3.1415
|
||||||
|
|
||||||
|
#if PI == 4
|
||||||
|
DoStuff()
|
||||||
|
#elif PI == 3
|
||||||
|
DoOtherStuff()
|
||||||
|
#else
|
||||||
|
DoNothing()
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
var/GlobalCounter = 0
|
||||||
|
var/const/CONST_VARIABLE = 2
|
||||||
|
var/list/MyList = list("anything", 1, new /datum/entity)
|
||||||
|
var/list/EmptyList[99] // creates a list of 99 null entries
|
||||||
|
var/list/NullList = null
|
||||||
|
|
||||||
|
/*
|
||||||
|
Entity Class
|
||||||
|
*/
|
||||||
|
|
||||||
|
/datum/entity
|
||||||
|
var/name = "Entity"
|
||||||
|
var/number = 0
|
||||||
|
|
||||||
|
/datum/entity/proc/myFunction()
|
||||||
|
world.log << "Entity has called myFunction"
|
||||||
|
|
||||||
|
/datum/entity/New()
|
||||||
|
number = GlobalCounter++
|
||||||
|
|
||||||
|
/*
|
||||||
|
Unit Class, Extends from Entity
|
||||||
|
*/
|
||||||
|
|
||||||
|
/datum/entity/unit
|
||||||
|
name = "Unit"
|
||||||
|
|
||||||
|
/datum/entity/unit/New()
|
||||||
|
..() // calls the parent's proc; equal to super() and base() in other languages
|
||||||
|
number = rand(1, 99)
|
||||||
|
|
||||||
|
/datum/entity/unit/myFunction()
|
||||||
|
world.log << "Unit has overriden and called myFunction"
|
||||||
|
|
||||||
|
// Global Function
|
||||||
|
/proc/ReverseList(var/list/input)
|
||||||
|
var/list/output = list()
|
||||||
|
for(var/i = input.len; i >= 1; i--) // IMPORTANT: List Arrays count from 1.
|
||||||
|
output += input[i] // "+= x" is ".Add(x)"
|
||||||
|
return output
|
||||||
|
|
||||||
|
// Bitflags
|
||||||
|
/proc/DoStuff()
|
||||||
|
var/bitflag = 0
|
||||||
|
bitflag |= 8
|
||||||
|
return bitflag
|
||||||
|
|
||||||
|
/proc/DoOtherStuff()
|
||||||
|
var/bitflag = 65535 // 16 bits is the maximum amount
|
||||||
|
bitflag &= ~8
|
||||||
|
return bitflag
|
||||||
|
|
||||||
|
// Logic
|
||||||
|
/proc/DoNothing()
|
||||||
|
var/pi = PI
|
||||||
|
if(pi == 4)
|
||||||
|
world.log << "PI is 4"
|
||||||
|
else if(pi == CONST_VARIABLE)
|
||||||
|
world.log << "PI is [CONST_VARIABLE]!"
|
||||||
|
else
|
||||||
|
world.log << "PI is approximety [pi]"
|
||||||
Reference in New Issue
Block a user