mirror of
https://github.com/Ed94/metadesk.git
synced 2026-08-06 15:48:47 +00:00
[examples] rearrange; add hello_world.mdesk example file
This commit is contained in:
@@ -9,9 +9,11 @@ cd ..
|
|||||||
echo "~~~ Build All Exampes ~~~"
|
echo "~~~ Build All Exampes ~~~"
|
||||||
bin/bld_core.sh show_ctx
|
bin/bld_core.sh show_ctx
|
||||||
|
|
||||||
bin/bld_core.sh unit datadesk_like examples/datadesk_like_template.c
|
metasrc="examples/metaprograms"
|
||||||
bin/bld_core.sh unit node_errors examples/node_errors/node_errors.c
|
|
||||||
bin/bld_core.sh unit parse_check examples/parse_check.c
|
bin/bld_core.sh unit datadesk_like $metasrc/datadesk_like_template.c
|
||||||
|
bin/bld_core.sh unit node_errors $metasrc/node_errors.c
|
||||||
|
bin/bld_core.sh unit parse_check $metasrc/parse_check.c
|
||||||
|
|
||||||
echo
|
echo
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
/* the hello world file */
|
||||||
|
|
||||||
|
hello world!
|
||||||
|
"hello world!"
|
||||||
|
|
||||||
|
// sets
|
||||||
|
(hello world!)
|
||||||
|
[hello world!]
|
||||||
|
{hello world!}
|
||||||
|
|
||||||
|
// sets with labels
|
||||||
|
hello: world!
|
||||||
|
hello: (world!)
|
||||||
|
|
||||||
|
// tags
|
||||||
|
@exclaim "hello world"
|
||||||
|
@message
|
||||||
|
{
|
||||||
|
@recipient world
|
||||||
|
@contents hello
|
||||||
|
@punctuate !
|
||||||
|
}
|
||||||
@@ -35,7 +35,7 @@ int main(int argument_count, char **arguments)
|
|||||||
|
|
||||||
// parse all files passed to the command line
|
// parse all files passed to the command line
|
||||||
MD_Node *list = MD_MakeList(arena);
|
MD_Node *list = MD_MakeList(arena);
|
||||||
for(int i = 1; i < argument_count; i += 1)
|
for (int i = 1; i < argument_count; i += 1)
|
||||||
{
|
{
|
||||||
|
|
||||||
// parse the file
|
// parse the file
|
||||||
@@ -66,7 +66,7 @@ int main(int argument_count, char **arguments)
|
|||||||
// can easily check the severity of a entire parse by looking at the
|
// can easily check the severity of a entire parse by looking at the
|
||||||
// `max_message_kind` field on the errors from the parse result. Here
|
// `max_message_kind` field on the errors from the parse result. Here
|
||||||
// only push the parse result onto our list if there were no errors.
|
// only push the parse result onto our list if there were no errors.
|
||||||
if (parse_result.errors.max_message_kind >= MD_MessageKind_Error)
|
if (parse_result.errors.max_message_kind < MD_MessageKind_Error)
|
||||||
{
|
{
|
||||||
MD_PushNewReference(arena, list, parse_result.node);
|
MD_PushNewReference(arena, list, parse_result.node);
|
||||||
}
|
}
|
||||||
@@ -85,9 +85,9 @@ int main(int argument_count, char **arguments)
|
|||||||
// of roots from the parses we have built. Underneath the surface this
|
// of roots from the parses we have built. Underneath the surface this
|
||||||
// macro automatically resolves the reference at the beginning of each
|
// macro automatically resolves the reference at the beginning of each
|
||||||
// loop step.
|
// loop step.
|
||||||
for(MD_EachNodeRef(root, list->first_child))
|
for (MD_EachNodeRef(root, list->first_child))
|
||||||
{
|
{
|
||||||
for(MD_EachNode(node, root->first_child))
|
for (MD_EachNode(node, root->first_child))
|
||||||
{
|
{
|
||||||
// @notes The Metadesk library likes to use MD_String8List for
|
// @notes The Metadesk library likes to use MD_String8List for
|
||||||
// functions that build and return big strings. This simplifies
|
// functions that build and return big strings. This simplifies
|
||||||
+3
-1
@@ -18,7 +18,9 @@ Example Programs:
|
|||||||
[ ] Example multi-threaded parsing
|
[ ] Example multi-threaded parsing
|
||||||
|
|
||||||
Example Metadesk Files:
|
Example Metadesk Files:
|
||||||
[ ] Hello world
|
[x] Hello world
|
||||||
|
[ ] identifiers, numbers, strings, and symbols
|
||||||
|
[ ] sets, seperators, labels, and tags
|
||||||
|
|
||||||
|
|
||||||
Allen's Final Tweak Notes (September 10th 2021):
|
Allen's Final Tweak Notes (September 10th 2021):
|
||||||
|
|||||||
Reference in New Issue
Block a user