- Updated stuff

Configuration

- Updated information about `dgen` flags
This commit is contained in:
Tristan B. Velloza Kildaire 2023-08-16 16:21:15 +02:00
parent 7155cb9b77
commit 6674c67674
41 changed files with 170 additions and 58 deletions

View File

@ -1,8 +1,15 @@
---
title: Tristan Programming Language
subtitle: _From start to finish_
author: Tristan B. V. Kildaire
author: Tristan B. Velloza Kildaire
date: 26 July 2023
documentclass: scrbook
classoption:
- oneside
# headers-includes:
# - \usepackage{titling}
# - \pretitle{\begin{center}
# \includegraphics[width=2in,height=2in]{docs_src/logo.png}\LARGE\\
# - \posttitle{\end{center}}
---

View File

@ -184,12 +184,12 @@ position += 2;
Helper functions relating to character and token availability.
| Method name | Return type | Description |
|--------------------|-------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `hasToken()` | `bool` | Returns `true` if there is a token currently built i.e. `currentToken.length != 0`, `false` otherwise. |
| `isBackward()` | `bool` | Returns `true` if we can move the character pointer backwards, `false` otherwise. |
| `isForward()` | `bool` | Returns `true` if we can move the character pointer forward, `false` otherwise. |
| `isNumericalStr()` | `bool` | This method is called in order to chck if the build up, `currentToken`, is a valid numerical string. If the string is empty, then it returns `false`. If the string is non-empty and contains anything other than digits then it returns `false`, otherwise is returns `true`. |
| Method name | Return type | Description |
|--------------------|-------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `hasToken()` | `bool` | Returns `true` if there is a token currently built i.e. `currentToken.length != 0`, `false` otherwise. |
| `isBackward()` | `bool` | Returns `true` if we can move the character pointer backwards, `false` otherwise. |
| `isForward()` | `bool` | Returns `true` if we can move the character pointer forward, `false` otherwise. |
| `isNumericalStr()` | `bool` | This method is called in order to check if the build up, `currentToken`, is a valid numerical string. If the string is empty, then it returns `false`. If the string is non-empty and contains anything other than digits then it returns `false`, otherwise is returns `true`. |
TODO: There are probably some missing but the above are the most
general/used helper methods
@ -209,12 +209,6 @@ character == '\n' || character == '~' || character =='.' ||
character == ':';
```
!!! error FInish this page
             
 \| (TODO: make it texttt)   (TODO: not appearing)   
Whenever this method returns `true` it generally means you should flush
the current token, start a new token add the offending spliter token and
flush that as well.

View File

@ -129,7 +129,7 @@ config.addConfig(ConfigEntry("dgen:pretty_code", true));
config.addConfig(ConfigEntry("dgen:emit_entrypoint_test", true));
/* Set the mapping to hashing of entity names (TODO: This should be changed before release) */
config.addConfig(ConfigEntry("emit:mapper", "hashmapper"));
config.addConfig(ConfigEntry("dgen:mapper", "hashmapper"));
```
##### Retrieval of entries

View File

@ -1,3 +1 @@
# Introduction
![](tlang_dev.png)

View File

@ -9,6 +9,16 @@ are placed into sections whereby they are related.
**TODO:** Finish implementing this
### Comments
These are the basic types of comments supported.
(* TODO: I need to define all symbols as well so we can get this right *)
(* As I don't like the ?-based special sequence *)
singleComment ::= "//", { anything };
anything ::= ? all ASCII characters excluding newline ?
### Literals
These make are the basic atoms that define literals.
@ -18,7 +28,10 @@ These make are the basic atoms that define literals.
| "W" | "X" | "Y" | "Z" | "a" | "b" | "c" | "d" | "e" | "f" | "g"
| "h" | "i" | "j" | "k" | "l" | "m" | "n" | "o" | "p" | "q" | "r"
| "s" | "t" | "u" | "v" | "w" | "x" | "y" | "z";
number ::= "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9";
number ::= ("0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9") [encoder];
encoder ::= "S" | "B" | "W" | "I" | "L" | "UB" | "UW" | "UI" | "UL" | "SB"
"SW" | "SI" | "SL";
float ::= (number | {number}), ".", (number | {number});
@ -61,7 +74,7 @@ in some cases as well.
comment ::= singleComment | multiComment;

View File

@ -0,0 +1,28 @@
## Comments
T supports two types of comments, these are described below.
### Single-line comments
Single-line comments can only span a line, one declares such a comment
with the symbol `//` followed by arbitrary text as follows:
``` d
//This is a comment
// // This is also a Comment
//This too
```
### Multi-line comments
Multi-line comments can span multiple lines but may not contain the `/*`
or `*/` symbols are these, as you shall see, demarcate the beginnings
and endings of multi-line comments:
``` d
/* This is
A
multi-line
comment
*/
```

View File

@ -25,13 +25,7 @@ These options configure the C code emitter.
will be correctly indented. If `false` then no such prettifying
will occur.
- Default: `true`
### `emit`
This controls aspects of the `CodeEmitter` API, meaning irrespective of
which emitter (such as `dgen`) is used.
1. `emit:mapper`
2. `dgen:mapper`
- This entry holds a string value
- This controls how symbol names within T are translated
- The two available options are:
@ -39,3 +33,27 @@ which emitter (such as `dgen`) is used.
2. `"lebanese"` - all periods (`.`) within T symbols are replaced
by underscores (`_`)
- Default: `"hashmapper"`
3. `dgen:emit_entrypoint_test`
- This entry holds a boolean value
- If `true` then instrumentation code will be added to the final
output source code prior to compilation
- Default: `true`
4. `dgen:preinline_args`
- This entry holds a boolean value
- If `true` then the arguments (expressions) given to a function
call will be placed in adhoc variables declared in order of
appearance
- These *variables* will be passed to the function call then
- Default: `false` (TODO: change)
5. `dgen:compiler`
- This entry holds a string value
- This is the path to the compiler executable that should be used to
compile the generated C code
- Default: `clang`
### `emit`
This controls aspects of the `CodeEmitter` API, meaning irrespective of
which emitter (such as `dgen`) is used.
TODO: Move `dgen_emit_entrypoint_test` and `dgen:pretty_code` here.

View File

@ -1,8 +1,15 @@
---
title: Tristan Programming Language
subtitle: _From start to finish_
author: Tristan B. V. Kildaire
author: Tristan B. Velloza Kildaire
date: 26 July 2023
documentclass: scrbook
classoption:
- oneside
# headers-includes:
# - \usepackage{titling}
# - \pretitle{\begin{center}
# \includegraphics[width=2in,height=2in]{docs_src/logo.png}\LARGE\\
# - \posttitle{\end{center}}
---

View File

@ -153,7 +153,7 @@ Helper functions relating to character and token availability.
| `hasToken()` | `bool` | Returns `true` if there is a token currently built i.e. `currentToken.length != 0`, `false` otherwise. |
| `isBackward()` | `bool` | Returns `true` if we can move the character pointer backwards, `false` otherwise. |
| `isForward()` | `bool` | Returns `true` if we can move the character pointer forward, `false` otherwise. |
| `isNumericalStr()` | `bool` | This method is called in order to chck if the build up, `currentToken`, is a valid numerical string. If the string is empty, then it returns `false`. If the string is non-empty and contains anything other than digits then it returns `false`, otherwise is returns `true`. |
| `isNumericalStr()` | `bool` | This method is called in order to check if the build up, `currentToken`, is a valid numerical string. If the string is empty, then it returns `false`. If the string is non-empty and contains anything other than digits then it returns `false`, otherwise is returns `true`. |
@ -174,16 +174,8 @@ character == '\n' || character == '~' || character =='.' ||
character == ':';
```
!!! error
FInish this page
• \texttt{;} \texttt{,} \texttt{(} \texttt{)} \texttt{[} \texttt{]} \texttt{+} \texttt{-} \texttt{/} \texttt{\%} \texttt{*} \texttt{\&} \texttt{\{} \texttt{\}}
• \texttt{=} | (TODO: make it texttt) \texttt{\^} \texttt{!} \texttt{\\n}(TODO: \n not appearing) \texttt{\~} \texttt{.} \texttt{\:}
Whenever this method returns `true` it generally means you should flush the current token, start a new token add the offending spliter token and flush that as well.
### Others
TODO: Document the other methods remaining

View File

@ -200,7 +200,7 @@ config.addConfig(ConfigEntry("dgen:pretty_code", true));
config.addConfig(ConfigEntry("dgen:emit_entrypoint_test", true));
/* Set the mapping to hashing of entity names (TODO: This should be changed before release) */
config.addConfig(ConfigEntry("emit:mapper", "hashmapper"));
config.addConfig(ConfigEntry("dgen:mapper", "hashmapper"));
```
##### Retrieval of entries

View File

@ -1,3 +1,2 @@
# Introduction
![](tlang_dev.png)

View File

@ -8,6 +8,18 @@ ones and these are placed into sections whereby they are related.
**TODO:** Finish implementing this
### Comments
These are the basic types of comments supported.
```
(* TODO: I need to define all symbols as well so we can get this right *)
(* As I don't like the ?-based special sequence *)
singleComment ::= "//", { anything };
anything ::= ? all ASCII characters excluding newline ?
```
### Literals
These make are the basic atoms that define literals.
@ -18,7 +30,10 @@ letter ::= "A" | "B" | "C" | "D" | "E" | "F" | "G" | "H" | "I" | "J" | "K"
| "W" | "X" | "Y" | "Z" | "a" | "b" | "c" | "d" | "e" | "f" | "g"
| "h" | "i" | "j" | "k" | "l" | "m" | "n" | "o" | "p" | "q" | "r"
| "s" | "t" | "u" | "v" | "w" | "x" | "y" | "z";
number ::= "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9";
number ::= ("0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9") [encoder];
encoder ::= "S" | "B" | "W" | "I" | "L" | "UB" | "UW" | "UI" | "UL" | "SB"
"SW" | "SI" | "SL";
float ::= (number | {number}), ".", (number | {number});
```
@ -64,7 +79,7 @@ statement ::= discard | vdecl;
comment ::= singleComment | multiComment;

View File

@ -0,0 +1,25 @@
## Comments
T supports two types of comments, these are described below.
### Single-line comments
Single-line comments can only span a line, one declares such a comment with the symbol `//` followed by arbitrary text as follows:
```{.d}
//This is a comment
// // This is also a Comment
//This too
```
### Multi-line comments
Multi-line comments can span multiple lines but may not contain the `/*` or `*/` symbols are these, as you shall see, demarcate the beginnings and endings of multi-line comments:
```{.d}
/* This is
A
multi-line
comment
*/
```

View File

@ -20,15 +20,30 @@ These options configure the C code emitter.
* This entry holds a boolean value
* If `true` then the emitted code will be prettified, meaning it will be correctly indented. If `false` then no such prettifying will occur.
* Default: `true`
### `emit`
This controls aspects of the `CodeEmitter` API, meaning irrespective of which emitter (such as `dgen`) is used.
1. `emit:mapper`
2. `dgen:mapper`
* This entry holds a string value
* This controls how symbol names within T are translated
* The two available options are:
1. `"hashmapper"` - the hash of the T symbol name is the result
2. `"lebanese"` - all periods (`.`) within T symbols are replaced by underscores (`_`)
* Default: `"hashmapper"`
3. `dgen:emit_entrypoint_test`
* This entry holds a boolean value
* If `true` then instrumentation code will be added to the final output source code prior to compilation
* Default: `true`
4. `dgen:preinline_args`
* This entry holds a boolean value
* If `true` then the arguments (expressions) given to a function call will be placed in adhoc variables declared in order of appearance
* These _variables_ will be passed to the function call then
* Default: `false` (TODO: change)
5. `dgen:compiler`
* This entry holds a string value
* This is the path to the compiler executable that should be used to compile the generated C code
* Default: `clang`
### `emit`
This controls aspects of the `CodeEmitter` API, meaning irrespective of which emitter (such as `dgen`) is used.
TODO: Move `dgen_emit_entrypoint_test` and `dgen:pretty_code` here.

View File

@ -17,19 +17,20 @@ nav:
- Language:
- Introduction: language/30-index.md
- Grammar: language/31-grammar.md
- Literals: language/32-literals.md
- Types: language/33-types.md
- Variables: language/34-variables.md
- Conditionals: language/35-conditionals.md
- Loops: language/36-loops.md
- Funtions: language/37-functions.md
- Arrays: language/38-arrays.md
- Pointers: language/39-pointers.md
- Extern: language/43-extern.md
- Structs: language/40-structs.md
- OOP: language/41-oop.md
- Modules: language/42-modules.md
- Annotations: language/44-annotations.md
- Comments: language/32-comments.md
- Literals: language/33-literals.md
- Types: language/34-types.md
- Variables: language/35-variables.md
- Conditionals: language/36-conditionals.md
- Loops: language/37-loops.md
- Funtions: language/38-functions.md
- Arrays: language/39-arrays.md
- Pointers: language/40-pointers.md
- Extern: language/44-extern.md
- Structs: language/41-structs.md
- OOP: language/42-oop.md
- Modules: language/43-modules.md
- Annotations: language/45-annotations.md
- Configuration: language/50-configuration.md
- Implementation:
- Introduction: implementation/30-introduction.md