yUML is an UML scripting tool from yUml.me (crafted by Tobin Harris) that is easy to use. Still it may be too cryptic for non-IT Business Analysts who would prefer to be able to write complete english sentences instead of mathematical-like symbology. Rebol can make it even easier with a custom end-user friendly dialect (Rebol’s parliance for Domain Specific Language). Suppose we want to create this Diagram:

We would write this set of instructions in nearly plain english:
Blogger is a User
Admin is a Blogger
Author is a Blogger
Subscriber is a User
and our Rebol Dialect Script would translate it to yUML.me dialect:
[Blogger]^[User]
[Admin]^[Blogger]
[Author]^[Blogger]
[Subscriber]^[User]
Other example - if we want to create this diagram:

We would write this:
Admin Manage Site
Manage Site Include Manage Users
Manage Site Include Manage Themes
Manage Site Include Manage Plugins
which would be translated into yUML.me dialect as:
[Admin]-(Manage Site)
(Manage Site)>(Manage Users)
(Manage Site)>(Manage Themes)
(Manage Site)>(Manage Plugins)
Extend relation is also supported though I won’t give any example. In this lesson we limit to Use Case Diagrams - we will cope with Class Diagrams in another lesson.
Our whole Rebol script below uses what we learnt previously:
- Automate YUml Diagrams with Rebol
- Creating a Domain Specific Language
- Creating a flexible Robot Worker to automate tasks
So here it is, you should be able to study and understand it after reading the above tutorials (to test it online you can type in rebol console “do http://reboltutorial.com/source/yumldialect.r” and paste the result in your notepad - I advise you to use Notepad2 instead of Notepad because it can highlight Rebol’s brackets and string braces delimiters):
Rebol [
Name: "Yuml Robot"
Description: "Generate Yuml Syntax"
Version: 1.0.0
Change: ""
]
ROBOT: make object! [
output: copy ""
note-rule: [(color: "beige") some [
'note [
copy note-string to 'fond thru 'fond copy color to end
(append output rejoin ["note: " note-string "{" "bg:" color "}"])
|
copy note-string to end (append output rejoin ["note: " note-string "{" "bg:" color "}"])
]
]
| copy note-string to 'fond thru 'fond copy color to end
(append output rejoin ["note: " note-string "{" "bg:" color "}"])
|
copy note-string to end (append output rejoin ["note: " note-string "{" "bg:" color "}"])
]
actor-rule: [some [ [copy Actor to 'is thru 'is 'a 'Actor (append output rejoin ["[" Actor "]"])]
| [copy Actor to 'is thru 'is 'a copy Actor2 to end (append output rejoin ["[" Actor "]^[" Actor2 "]"])]
]
]
extend-rule: [some [copy UseCase2 to 'Extend thru 'Extend copy UseCase1 to end (append output rejoin ["(" UseCase1 ")<(" UseCase2 ")"])]
]
include-rule: [some [copy UseCase2 to 'Include thru 'Include copy UseCase1 to end (append output rejoin ["(" UseCase2 ")>(" UseCase1 ")"])]
]
use-rule: [some [copy Actor to 'Manage thru 'Manage copy UseCase to end (append output rejoin ["[" Actor "]-(" "Manage " UseCase ")"])]
]
yuml-rule: [(Actor: copy [] Actor2: copy []) actor-rule | extend-rule | include-rule | use-rule | note-rule ]
;task1 function
Generate: func [yuml-orders][
output: copy ""
block-orders-draft: parse/all yuml-orders "^/"
block-orders: copy []
foreach order block-orders-draft [
if (length? (order: trim/head/tail order)) > 0 [
append block-orders order
]
]
foreach order block-orders [
order-block: to-block order
parse order-block yuml-rule
append output newline
]
]
;task2 function
list: func [][
foreach Task Tasks-List [
print Task
]
]
;core engine
run: func
[
Tasks-List: copy [] ; reset the list
output: copy ""
do bind code 'self
]
]
Worker: Make Robot[]
Yuml-Orders-list: [
{
Wordpress Profiles
Blogger is a User
Admin is a Blogger
Author is a Blogger
Subscriber is a User
}
{ Blogger Role
Blogger Manage Posts
}
{
Admin Roles
Admin Manage Site
Manage Site Include Manage Users
Manage Site Include Manage Themes
Manage Site Include Manage Plugins
}
]
Robot-Orders: [
Yuml-Output-List: copy []
foreach Yuml-Orders Yuml-Orders-list [
Print ["Yuml-Orders: " Yuml-Orders " started ..." newline]
generate Yuml-Orders
Print output
Append Yuml-Output-List copy output
Print ["Yuml-Orders: " Yuml-Orders " done! " newline]
Print Newline
]
Probe Yuml-Output-List
write clipboard:// mold Yuml-Output-List
Print "Copied to clipboard..."
]
Worker/Run Robot-Orders
input
If you paste into Notepad2, this should give you:

You can then go to yUml.me Use Case Diagram to render them:



![]()
This script is now available on AskCodeGeneration.com.
If you’re looking for Sequence Diagrams look here.


















Thank you for this tutorial. I’ve been using Rebol for over ten years now though I am far from the skill level of those Rebolers in Altme and the mail list (another great source of knowledge, btw). For whatever reason I stayed away from building my own dialects but now have found a good reason to delve in. Your tutorial is one, if not the best, I’ve found so far. It’s saved me much time. Thanks again.
James_Nak
Thank you, James, I’m really not an expert, I’m just learning Rebol but that may explain why my tutorial is so accessible
Please, since you’re on altme and the rebol mailing list, make reboltutorial.com known (I don’t know why altme doesn’t want to connect from my Vista install and I have never succeeded to receive from or post to the mailing).
I don’t know. You have some really cool stuff on your site. I posted a link on Altme and the email list today. You should be getting some traffic. The guys are incredible and really helpful.
Again thanks for sharing your knowledge.
It’s cool because I’m doing them for my own needs, I have too many cool ideas small and big since I’m a child I’m desperate to live long enough to implement all of them