Skip to content

Commit adb512f

Browse files
committed
Initial setup for hugo
1 parent 12d57e7 commit adb512f

File tree

23 files changed

+2470
-30
lines changed

23 files changed

+2470
-30
lines changed

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "themes/hextra"]
2+
path = themes/hextra
3+
url = https://github.com/imfing/hextra

.hugo_build.lock

Whitespace-only changes.

LICENSE

Lines changed: 0 additions & 21 deletions
This file was deleted.

archetypes/.gitkeep

Whitespace-only changes.

archetypes/default.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
+++
2+
date = '{{ .Date }}'
3+
draft = true
4+
title = '{{ replace .File.ContentBaseName "-" " " | title }}'
5+
+++

assets/.gitkeep

Whitespace-only changes.

content/_index.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
+++
2+
date = '2025-02-08T18:25:19+05:00'
3+
draft = false
4+
title = 'Alis Language'
5+
toc = false
6+
+++
7+
// TODO write Alis home page

content/about/_index.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
+++
2+
date = '2025-02-08T18:38:22+05:00'
3+
draft = false
4+
title = 'About Alis'
5+
+++
6+
// TODO write About Alis

content/docs/_index.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
+++
2+
date = '2025-02-08T18:41:47+05:00'
3+
draft = false
4+
title = 'Docs'
5+
linkTitle = 'Documentation'
6+
sidebar.open = true
7+
+++
8+
This is Alis Documentation
9+
// TODO write Alis Documentation home page

content/docs/spec/_index.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
+++
2+
date = '2025-02-08T18:44:16+05:00'
3+
draft = false
4+
title = 'Alis Language Specification'
5+
+++
6+
This is Alis Specification
7+
// TODO write Alis Specification home page

content/docs/spec/bytecode/_index.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
+++
2+
date = '2025-02-08T19:53:30+05:00'
3+
draft = false
4+
title = 'Alis ByteCode'
5+
+++
6+
The Alis Virtual Machine executes ByteCode written in the Alis Byte Code (ABC) format. It can be written in either human readable text, or in a binary format.
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
+++
2+
date = '2025-02-08T19:54:00+05:00'
3+
draft = false
4+
title = 'Alis Byte Code (Binary)'
5+
+++
6+
This document describes how Alis stores bytecode in binary format. The version
7+
described in this document is the latest, see table below.
8+
9+
The binary file contains these sections of bytecode in the this order:
10+
11+
1. magic number
12+
2. version bytes
13+
3. magic number postfix
14+
4. metadata
15+
7. labels
16+
5. instruction & data
17+
18+
## Magic Bytes
19+
20+
This part is always 17 bytes.
21+
22+
The first 7 bytes are to be:
23+
24+
ASCII:
25+
```
26+
ALISBC-
27+
```
28+
29+
hexadecimal:
30+
```
31+
41 4C 49 53 42 43 2D
32+
```
33+
These are followed by 2 bytes, which are used to identify version information.
34+
35+
8 bytes after these bytes are ignored, these are the magic number postfix.
36+
37+
### Version Identifying Bytes
38+
39+
| Version number, ushort| First Alis Version |
40+
| --------------------- | --------------------- |
41+
| `0x0002` | v0.0.0 |
42+
43+
Since all integers are stored in little endian, `0x0001` will be stored as:
44+
`01 00`
45+
46+
Byte combinations not present in table above are reserved for future versions.
47+
48+
---
49+
50+
## Metadata
51+
52+
An 8 byte (64 bit) unsigned integer used to store number of bytes in metadata,
53+
followed by the metadata.
54+
55+
---
56+
57+
## Labels
58+
59+
An 8 byte (64 bit) unsigned integer stores the number of labels. This is
60+
followed by the labels.
61+
62+
A label is stored as:
63+
64+
1. CodeIndex - fixed length, 8 bytes
65+
2. Name - variable length (`char` array).
66+
67+
---
68+
69+
## Instructions & Data
70+
71+
An 8 byte (64 bit) unsigned integer stores the _number of bytes_ used for
72+
storing instruction codes and their data. Following bytes are the `code` part
73+
of the ByteCode.
74+
75+
---
76+
77+
**All integers are stored in little endian encoding**
78+
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
+++
2+
date = '2025-02-08T19:53:37+05:00'
3+
draft = false
4+
title = 'Alis Byte Code (Text)'
5+
+++
6+
## Statements
7+
8+
A statement is a single line. A statement in Alis ByteCode can be:
9+
10+
* Empty or whitespace
11+
* Label
12+
* Instruction + optional args
13+
* Label + Instruction + optional args
14+
15+
## Instructions
16+
17+
Instructions are written as instructionName followed by any argument(s),
18+
separeted by whitespace. The instructionName is case sensitive.
19+
20+
```
21+
instructionName argument argument
22+
```
23+
24+
## Labels
25+
26+
Label names are case sensitive as well.
27+
28+
```
29+
SomeLabel:
30+
SomeInstruction
31+
MoreInstructions
32+
OtherLabel: AnotherInstruction withSomeArg andAnotherArg # comment
33+
Jump SomeLabel
34+
```
35+
36+
## Whitespace
37+
38+
Whitespace can be either tab(s) or space(s), and is ignored.
39+
At least 1 character of whitespace is necessary between labels, instruction
40+
names, and arguments.
41+
42+
## Instruction Arguments
43+
44+
An instruction can have any number of arguments. These can be of following
45+
types:
46+
47+
* Integer - signed integer (`ptrdiff_t`)
48+
* Double - a float
49+
* Boolean - true (a non zero ubyte), or false (0)
50+
* String - a string, enclosed between `"`
51+
* Label - position in code. Written as `@LabelName`.
52+
53+
### Strings
54+
55+
These are written like: `"someString"`.
56+
57+
The back-slash character can be used to include characters like `"` or tab by
58+
doing: `"tab: \t, quotationMark: \""`
59+
60+
### Characters
61+
62+
These are written like: `'c'`.
63+
64+
### Hexadecimal Integer
65+
66+
These are read as of type Integer, and are written like: `0xFFF`, where `FFF`
67+
is the number.
68+
69+
### Binary Integer
70+
71+
Integer can be written in binary as: `0b1111`, where `1111` is the number.
72+
73+
## Comments
74+
75+
Anything following a `#` (including the `#`) are considered comments and are
76+
ignored:
77+
78+
```
79+
#comment
80+
someInstruction someArgument # this is a comment
81+
```
82+

content/docs/spec/grammar.md

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
+++
2+
date = '2025-02-08T18:47:28+05:00'
3+
draft = false
4+
title = 'Alis Grammar'
5+
+++
6+
```ebnf
7+
(* Note: the `.` special token is used to represent any non-newline character*)
8+
whitespace = {space | "\t" | "\n"}-;
9+
singleLineComment = "//", {? . ?}-, ? newline ?;
10+
multiLineComment = "/*", {? . ?}-, "*/";
11+
identifier = ("_" | alphabet), {"_" | alphabet | decimalDigit};
12+
shebang = "#!", {? . ?}, ? newline ?;
13+
14+
integerDecimal = ["-"], {decimalDigit}-;
15+
integerBinary = "0", ("b" | "B"), {"0" | "1"}-;
16+
integerHex = "0", ("x" | "X"), {hexadecimalDigit}-;
17+
integerScientific = (integerDecimal | literalFloat), "e", integerDecimal;
18+
literalInt = integerDecimal | integerBinary | integerHex | integerScientific;
19+
20+
literalFloat = ["-"], {decimalDigit}-, ".", {decimalDigit}-;
21+
literalString = ('"', {? . ? | '\"'}, '"') |
22+
('"""', ? newline ?, {? . ? | '\"' | ? newline ?}, ? newline ?, '"""');
23+
literalChar = "'", (("\", ? . ?) | ? . ? | ("\", "'")), "'";
24+
literalBool = "true" | "false";
25+
26+
literalArray = "[", [{expr, ","}, expr], "]";
27+
28+
def = ["ipub" | "pub"], {attribute},
29+
(fnDef | fnDef | globVarDef | structDef | unionDef | enumDef |
30+
aliasDef | templateDef | import);
31+
32+
test = "utest", [literalString], statement;
33+
34+
moduleIdentifier = {identifier, "."}, identifier;
35+
import = {moduleIdentifier, ["as", identifier], ","},
36+
moduleIdentifier, ["as", identifier], ";";
37+
38+
statement = [cComp], ((expr | localVarDef | "break" | "continue"), ";" |
39+
block, [";"] | if | for | while | doWhile | switch | mixinInit, ";");
40+
block = "{", {statement}, "}";
41+
if = "if", smExpr, statement, ["else", statement];
42+
for = "for", "(", [identifier, ";"], expr, identifier, ";", expr, ")", statement;
43+
while = "while", smExpr, statement;
44+
doWhile = "do", statement, "while", smExpr, ";";
45+
switch = "switch", smExpr, {"case", smExpr, block}, "case", "_", block;
46+
mixinInit = "mixin", smExpr, "(", [{expr, ","}, expr], ")";
47+
48+
staticIf = "$if", smExpr, anyBlock, ["else", anyBlock];
49+
staticFor = "$for", "(", [identifier, ";"], expr, identifier, ";", expr, ")",
50+
anyBlock;
51+
staticSwitch = "$switch", smExpr, {"case", smExpr, anyBlock},
52+
"case", "_", anyBlock;
53+
cComp = {staticIf | staticFor | staticSwitch}-;
54+
55+
attribute = "#", smExpr;
56+
57+
tmParamList = "$(", [{tmParam, ","}, tmParam], ")", ["if", smExpr];
58+
tmParam = ("$type", identifier | ("alias", identifier) | (smExpr, identifier)),
59+
[":", smExpr];
60+
61+
keyVal = identifier, "=", expr;
62+
keyOptVal = identifier, ["=", expr];
63+
64+
fnDef = "fn", identifier, [tmParamList], paramList, "->",
65+
(smExpr, block | smExpr, ";");
66+
methodDef = "fn", "[", smExpr, "]", identifier, [tmParamList], paramList, "->",
67+
(smExpr, block | smExpr, ";");
68+
paramList = param | ("(", [{param, ","}, param], ")");
69+
param = ([smExpr], keyOptVal) | smExpr;
70+
fnAnon = "fn", paramList, "->", expr;
71+
72+
globVarDef = ("var" | "const"), smExpr, {keyOptVal, ","}, keyOptVal, ";";
73+
localVarDef = ("var" | "const"), {attribute}, ["static"], smExpr,
74+
{keyOptVal, ","}, keyOptVal, ";";
75+
76+
aggMember = ["pub" | "ipub"], {attribute},
77+
(smExpr, [{keyOptVal, ","}, keyOptVal] |
78+
"alias", identifier, "=", identifier), ";";
79+
structDef = "struct", identifier, [tmParamList], "{",
80+
{cComp | aggMember | mixinInit, ";"},
81+
"}";
82+
structExpr = "struct", "{", {cComp | aggMember | mixinInit, ";"}, "}";
83+
structValExpr = "{", {cComp | keyVal | mixinInit, ";"}, "}";
84+
unionDef = "union", identifier, [tmParamList], "{",
85+
{cComp | aggMember | mixinInit, ";"},
86+
"}";
87+
unionExpr = "union", "{", {cComp | aggMember | mixinInit, ";"}, "}";
88+
enumDef = "enum", smExpr, identifier, [tmParamList], ("=", expr, ";" |
89+
"{",
90+
{(cComp | keyOptVal | mixinInit), ","},
91+
[(cComp | keyOptVal | mixinInit)],
92+
"}"
93+
);
94+
95+
aliasDef = "alias", identifier, "=", expr, ";";
96+
97+
anyBlock = "{", {? . ? | anyBlock} ,"}";
98+
99+
templateDef = "template", ["mixin"], tmParamList, anyBlock;
100+
101+
intrinsic = "$", identifier, ["(", [{expr, ","}, expr], ")"];
102+
103+
expr = smExpr, [block];
104+
smExpr = ("(", {expr, ","}, expr, ")") | intrinsic |
105+
literalInt | literalChar | literalBool | literalFloat |
106+
literalString | fnAnon | structExpr | unionExpr | structValExpr |
107+
literalArray | ("const", smExpr) |
108+
(opPre, expr) | (expr, opPost) | (expr, opBin, expr) |
109+
(expr, "(", [{expr, ","}, expr], ")") |
110+
(expr, "[", [{expr, ","}, expr], "]");
111+
112+
opBin = "." | "??" | "!! "| "is" | "!is" | "*" | "/" | "%" | "+" | "-" | "<<" |
113+
">>" | "&" | "|" | "^" | ":" | "==" | "!=" | ">=" | "<=" | ">" | "<" |
114+
"&&" | "||" | "=" | "+=" | "-=" | "*=" | "/=" | "%=" |
115+
"&=" | "|=" | "^=" | "@=";
116+
117+
opPre = "@" | "is" | "!is" | "!" | "++" | "--" | "~";
118+
119+
opPost = "@" | "!" | "?" | "++" | "--" | "...";
120+
121+
module = [shebang], {def | test | mixinInit, ";"};
122+
```

0 commit comments

Comments
 (0)