3

UML is generally taught as a standardized way of diagramming software, however, I've heard recently that there's an actual grammar behind it. I've searched the UML specification and haven't found much that was sufficient in terms of describing an actual grammar.

Tools like PlantUML seem to have a text-based conversion for diagrams, but is this actual UML that adheres to a standard?

2 Answers 2

5

The UML language for creating models is defined using a meta-model, which is itself described using a sub-set of UML. This means that the official specification of UML uses UML diagrams to show which elements there are in the language and how they relate to each other.

This graphical way of specifying the language can be regarded as a grammar, but it does not match the notion of a text-based grammar.

There is no standardized way to express UML diagrams in human readable text formats.

2
  • 4
    We should never forget that when mathematicians define a term from first principles, then the term means exactly and only what the definition says. So, when mathematicians say that an alphabet is a set of distinct "things", a sentence is an ordered sequence of symbols, a language is set of sentences, and a grammar is a set of rules describing all legal sentences of the language, then Nodes and Edges on a piece of paper can be symbols, the way they are connected together can be a language, and the UML metamodel describing the rules can be a grammar. It just doesn't fit nicely into the … Commented Mar 31, 2023 at 9:22
  • 3
    "sequence of bytes parsed by yacc" model of the working programmer :-D Commented Mar 31, 2023 at 9:22
1

The UML specification uses a variant of the Backus-Naur Form (BNF) to specify the legal formats for models that conform to the UML. You can also find textual descriptions of the elements - syntax, semantics, descriptions of classifiers. You can also find machine-readable schemas designed for serialization, which correspond to the rules in the human-readable specification.

However, these aren't used to textually describe the diagrams themselves. That is, although they do describe the rules for the various types of diagrams, which elements are valid for each diagram type, and valid relations between elements, you cannot use them to create a diagram in a textual format. There are many text-to-UML tools, each with their own notation, so there's no standardization of representing the diagrams in textual forms.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.