From fc2046a176334037507f77de382abdabf2895aae Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Mon, 13 Jul 2015 19:10:59 -0700 Subject: 1771 --- global.mu | 14 ++++++++++++++ mu.vim | 3 ++- 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 global.mu diff --git a/global.mu b/global.mu new file mode 100644 index 00000000..839926a7 --- /dev/null +++ b/global.mu @@ -0,0 +1,14 @@ +# example program: creating and using global variables + +recipe main [ + # allocate 5 locations for globals + global-space:address:array:location <- new location:type, 5:literal + # read to globals by using /space:global + 1:number/space:global <- copy 3:literal + foo +] + +recipe foo [ + # ditto for writing to globals + $print 1:number/space:global +] diff --git a/mu.vim b/mu.vim index fb8c0b91..c5e7eebb 100644 --- a/mu.vim +++ b/mu.vim @@ -45,10 +45,11 @@ highlight link muNumber Constant syntax match muLabel "^\s\+[^ 0-9a-zA-Z{}\[\]][^ ]*\s*$" syntax match muLabel %[^ ]\+:label/\?[^ ,]*% highlight link muLabel Constant -syntax keyword muKeyword default-space next-ingredient ingredient | highlight link muKeyword Constant +syntax keyword muKeyword default-space global-space next-ingredient ingredient | highlight link muKeyword Constant syntax match muDelimiter "[{}]" | highlight link muDelimiter Delimiter syntax match muAssign " <- \|\" | highlight link muAssign SpecialChar +syntax match muGlobal %[^ ]\+:global/\?[^ ,]*% | highlight link muGlobal SpecialChar syntax keyword muControl reply reply-if reply-unless jump jump-if jump-unless loop loop-if loop-unless break break-if break-unless current-continuation continue-from create-delimited-continuation reply-delimited-continuation | highlight muControl ctermfg=3 " common keywords syntax keyword muRecipe recipe before after | highlight muRecipe ctermfg=208 -- cgit 1.4.1-2-gfad0