This repository has been archived by the owner on Dec 6, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
first-post-code.mur
98 lines (67 loc) · 3.71 KB
/
first-post-code.mur
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
/*
Murmur | (C) EnderCommunity
--------------------------------------------------------------------------------
This is a pitch file for Murmur that will include the general syntax for
Murmur, and all the functions that it can use.
This is Murmur code that can be processed by the first-post compiler!
*/
//(!) All the functions that start with a # are preprocessor functions
#import "path/to/myfile.esf"; //This will allow you to import Murmur files!
#import "path/to/mymodule1.esmf" as string Module1; //This will allow you to import Murmur modules!
function Module2;
#import "path/to/mymodule2.esmf" as Module2; //This will allow you to import Murmur modules!
#define ZERO 0 //You can use the `#define` function to define a variable that will be replaced by the provided value before the execution of this code
//(!) It is recommended that you start variable names with a capital letter!
int Num1 = 0, Num2 = 1, Num3 = 2; //Integers use the type 'int'
float Floa1 = 0.00, Floa2 = 0.01, Floa3 = 0.02; //Decimal numbers use the type 'float'
double Doub1 = 0.00, Doub2 = 0.01, Doub3 = 0.02; //Decimal numbers, that may be long, use the type 'double'
char Cha1 = 'A', Cha2 = 'B', Cha3 = 'C'; //You can also use normal quotes ("E"), characters use the type 'char'
string Str1 = "Hello there!", Str2 = "I'm a string!", Str3 = "I can be up to 2048 characters in length!"; //You can use variables with the type 'string' to store text
bool Bool1 = true, Bool2 = false; //Boolean variables use the type 'bool'
file File1 = new FileStream("path/filename.txt"), File2 = new FileStream("path/filename.txt", false), File3 = new FileStream("path/filename.txt", true); //the 2nd argument determines whether the file should be in a read-only mode or not. It's set to 'false' by default.
/*
You could also do this: `new FileStream::File(...)`;
*/
delete Num1, Cha2, File, HexData, Obj1; //You can delete variables. What happens when you delete a variable comes down to the type of the variable itself (e.g. When you delete a variable of the type 'file', the file stream will be closed)
/*
delete Const3; //This will result in an error;
Const3 = new FileStream("path/filename.txt"); //This too!
*/
int[] Array1 = new Array::Int(10);
string[] Array2 = new Array::String(10);
file[] Array3 = new Array::File(10);
Array1 = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
Array2 = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9"};
function::Int Func1(int a){
return a;
}
function::Void Func2(){
//
}
function Func3 = function::Int(){
return 0;
}
int Test1 = 0;
function::Int Exm(int a, function b, function::Int c){
keep int b = a; //This variable can be accessed the next time this function gets executed!
b; //You can't really know what is the output of this function!
c; //You know that this is a function that returns an int!
}
exit 0; //Exit the program with a success code! You could use `SUCCESS` for 0, or 'FAILURE' for -1
//exit FAILURE; //Exit the program with a failure code!
//You can think if functions variable management as it is in classes in C#!
/*
function::Int Hmm(function::function::c Callback){ //This is wrong, nested type determinations aren't supported!
//
}
*/
//Maybe don't give developers access to these functions
/*Allocate<int> AllocatedNumber = 10; //You can use the 'alloc<type>' identifier to allocate a specific amount of bytes
Pointer<int> Poi1 = Num1;
Pointer<double> Poi2 = Doub1;*/
//point a as fjekfakwfwa;
//You could make it so the user can specify a block of code that will not be
//parsed by the compiler. It would be basically a block of code that will run
//C code without any parser interferance.
//Murmur should automatically detect the use of libraries, and include them in the final C code!
//(Introduce Rules in Murmur???)