Last active
December 26, 2018 17:28
-
-
Save ndugger/61e6aec29b0648ad2aa208304af9ffb0 to your computer and use it in GitHub Desktop.
webscript (wip concept) (inspired by c++)
This file contains hidden or 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
| as | |
| define | |
| import | |
| @ | |
| & | |
| : | |
| ? | |
| () | |
| [] | |
| . |
This file contains hidden or 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.type | |
| std.type foo ( | |
| ) | |
| std.type bar + foo ( | |
| ) |
This file contains hidden or 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.boolean | |
| import std.function | |
| import std.integer | |
| import std.string | |
| import std.type | |
| std.function[ foo: std.integer, bar: std.boolean ] do_something -> std.string ( | |
| std.if[ bar ] -> 'foo' | |
| std.match[ foo ] ( | |
| 0: -> 'hello' | |
| 1: -> 'world' | |
| std.none: -> 'bar' | |
| ) | |
| ) | |
| do_something[ 0, false ] | |
| std.type app ( | |
| std.integer app_status: std.none | |
| std.string app_title: std.none | |
| std.function[ title: std.string ] app -> app ( | |
| app_status: 0 | |
| app_title: title | |
| ) | |
| std.function[ status: std.integer ] exit -> std.none ( | |
| app_status: status | |
| ) | |
| std.function[ ] start -> std.none ( | |
| ) | |
| ) | |
| app example[ 'example' ] | |
| example.start[ ] | |
| example.exit[ 1 ] |
This file contains hidden or 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.any | |
| import std.map | |
| import std.namespace | |
| import std.operator | |
| import std.symbol | |
| import std.type | |
| import std.vector | |
| std.namespace std ( | |
| std.type function[ argument_types: std.map[ std.symbol, std.any ] ] ( | |
| std.operator[ return_type ] -> ? ( | |
| ) | |
| std.operator[ ...arguments ] [ ? ] ( | |
| ) | |
| ) | |
| ) |
This file contains hidden or 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.boolean | |
| import std.macro | |
| import std.namespace | |
| std.namespace std ( | |
| std.macro if[ condition: std.boolean ] ( | |
| ) | |
| ) |
This file contains hidden or 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.namespace as namespace | |
| import std.type as type | |
| namespace std ( | |
| type map[ key_type?, value_type? ] ( | |
| ) | |
| ) |
This file contains hidden or 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.function | |
| import std.if | |
| import std.integer | |
| import std.namespace | |
| import std.none | |
| import std.or | |
| import std.type | |
| import std.vector | |
| import std.while | |
| std.namespace std ( | |
| std.type pool[ fill_type? ] ( | |
| std.function[ ] pool_allocator -> fill_type | |
| std.vector[ fill_type ] pool_contents | |
| std.integer pool_size | |
| std.function[ size: std.integer, allocator: std.function[ ] -> fill_type ] pool -> pool ( | |
| pool_allocator: allocator | |
| pool_size: size | |
| resize[ size ] | |
| ) | |
| std.function[ ] contents -> @std.vector[ fill_type ] ( | |
| -> pool_contents | |
| ) | |
| std.function[ ] empty -> std.boolean ( | |
| -> pool_contents.empty[ ] | |
| ) | |
| std.function[ ] size -> std.integer ( | |
| -> pool_contents.size[ ] | |
| ) | |
| std.function[ size: std.integer ] resize -> std.none ( | |
| std.if[ pool_size > size ] ( | |
| std.while[ pool_contents.size[ ] > size ] ( | |
| pool_contents.pop_back[ ] | |
| ) | |
| ) std.or ( | |
| std.while[ pool_contents.size[ ] < size ] ( | |
| pool_contents.push_back[ pool_allocator[ ] ] | |
| ) | |
| ) | |
| pool_size = size | |
| ) | |
| ) | |
| ) |
This file contains hidden or 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.macro | |
| import std.namespace | |
| import std.operator | |
| std.namespace std ( | |
| std.macro type ( | |
| std.operator[ ...arguments ] [ ? ] ( | |
| ) | |
| ) | |
| ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment