Skip to main content

FML Language Specification

Flexo Modeling Language — release 3.0

This directory holds the specification of FML, the language in which an Openflexo virtual model is written. It is organised as a book: read the chapters in order the first time, then use them as a reference.

The specification is derived from, and subordinate to, the SableCC grammar fml-parser/src/main/sablecc/fml.sablecc. Where this text and the grammar disagree about what is syntactically accepted, the grammar is right and this text has a bug. Where this text describes what an accepted program means, the sources are the semantic analyzers of fml-parser, the FML meta-model of flexo-foundation, and the executable examples of the platform; the cases in which the implementation does not do what the language intends are recorded in Appendix B, not hidden.

Contents​

#ChapterWhat it defines
1IntroductionScope, the two surfaces of the language, notation, conformance
2Lexical structureCharacters, comments, lexical states, tokens, keywords, literals
3Compilation unitsLayout of a .fml file; namespaces, use, import, typedef; resources and addresses
4TypesPrimitive, reference, generic and technology-specific types; versions; cardinalities; the typing space
5Models, concepts, events and enumsThe declarations that structure a program; containment; inheritance; invariants
6PropertiesStored, role, expression, abstract and get/set properties
7BehavioursMethods, creation and deletion schemes, listeners, technology-specific behaviours
8StatementsBlocks, declarations, conditions, loops, returns
9ExpressionsOperators, precedence, paths, calls, new, name resolution
10Edition actionsselect, match, delete, fire, notify, connect, log, technology actions
11AnnotationsSyntax and the annotations the platform interprets
12FML-scriptThe command and script surface
13Execution modelInstances, containment, evaluation, events, matching sets, failure
AGrammar summaryThe complete syntax, in EBNF
BKnown deviationsWhere the implementation departs from the language
CA complete exampleOne model and one script, annotated

Reading conventions​

  • monospace is source text. Italic introduces a term at its definition.
  • "Must", "must not", "may" and "need not" are normative and are written in lowercase.
  • An Implementation note states what the 3.0 implementation does; it is not part of the language when it conflicts with the rule above it, and it then cites a defect identifier (CORE-D-n) recorded in KNOWN_DEFECTS.md.
  • Every example in this specification parses: each one was submitted to the parser of the platform (the entry point that fits it: compilation unit, script, expression) when the text was written, and the few that are shown as rejected were checked to be rejected. Those that are quoted from the platform's test resources (flexo-test-resources; Appendix C in full) are also run by its automated tests, which assert their values. A fragment written to illustrate a rule has been checked against the grammar only; whether it resolves depends on the types and adapters around it.