Voxel resources
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Compiler design | |
Compilers | |
https://github.com/snazzy-d/SDC | |
https://github.com/dbohdan/embedded-scripting-languages | |
https://github.com/ishiura-compiler/CF3 | |
https://gitlab.com/styx-lang/styx | |
http://mlton.org/CompilerOverview | |
https://github.com/TurkeyMan/mlang | |
https://github.com/FeepingCreature/fcc | |
https://github.com/jondgoodwin/cone |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Regular expression for matching error messages in Sublime Text. | |
Insert into `file_regex` parameter of `.sublime-project` file. Then clicking the line with error message opens correct source file. | |
--- Escaped for file_regex (\ -> \\) | |
^(?:\\s*)(?:.*(?: at |@))?((?:[^\\(: ]|:(?!\\d))+)(?:\\(|:)(\\d+)(?:(?:,|:)(\\d+))?\\)?(?:: (.*))? | |
--- Raw regex (developed with https://regexr.com, used flags: global, multiline) | |
^(?:\s*)(?:.*(?: at |@))?((?:[^\(: ]|:(?!\d))+)(?:\(|:)(\d+)(?:(?:,|:)(\d+))?\)?(?:: (.*))? | |
--- Matches |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import std.array; | |
import std.format; | |
import std.string; | |
import std.file : write; | |
void main() | |
{ | |
string dir = `D:/sources/my_sources/tiny_jit/test_work_dir`; | |
foreach(s; [10,100,1000,10_000,100_000,1000_000]) { | |
//make_source_c(dir, s); | |
//make_source_d(dir, s); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import std.stdio; | |
void main() { | |
foreach(kw; keyword_strings) { | |
TokenType t = identifier_to_keyword(kw); | |
writefln("%s %s", kw, t); | |
} | |
} | |
TokenType identifier_to_keyword(const(char[]) tok) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import std.stdio; | |
import std.format; | |
// First attribute goes into IN_TOKEN table | |
enum State : ubyte { | |
// intermediate states | |
@(1) i_invalid, | |
@(1) i_id1, // _a-zA-Z | |
@(1) i_id2, // _a-zA-Z0-9 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// > vox hello_vox.vx && hello_vox | |
// hello windows | |
// > vox hello_vox.vx --target=linux-x64 | |
// > wsl ./hello_vox | |
// hello linux | |
#version(windows) { | |
@extern(module, "kernel32"): | |
enum u32 stdin = 0xFFFFFFF6; |
I measured my biggest code base written in Vox (which is mostly Vulkan bindings atm) and got the following numbers:
- 88140 tokens
- 17771 lines
- 4.95977 tokens/line on average
- 1 305 227 bytes of source code
- 1 410 240 bytes of token information
Source code: https://github.com/MrSmith33/voxelman/blob/master/source/voxelman/gui
Core widget components (https://github.com/MrSmith33/voxelman/blob/master/source/voxelman/gui/components.d):
- WidgetTransform - main component of any widget. Stores parent reference, relative position, absolute position, size, min size, measured size, and extra flags
- WidgetStyle - color and border color
- WidgetName - string of widget name
- WidgetType - string of widget type (for debugging)
- WidgetContainer - children widgets
- WidgetIsFocusable - if set becomes
focusedWidget
on pointer press.focusedWidget
will receive key and char events. - WidgetEvents - stores handlers for any event for the widget. Typical events:
NewerOlder