### Sample Content for HelloWorld Language Source: https://langium.org/docs/introduction/playground This section provides sample input content that conforms to the 'HelloWorld' grammar. It demonstrates the usage of the defined 'person' and 'Hello' keywords, including referencing previously defined persons. This content is used to test and validate the grammar's parsing capabilities. ```plaintext person John person Jane Hello John! Hello Jane! ``` -------------------------------- ### Generated Syntax Tree for HelloWorld Content Source: https://langium.org/docs/introduction/playground This represents the abstract syntax tree (AST) generated by Langium after parsing the sample 'HelloWorld' content. It shows the hierarchical structure of the parsed data, including types, attributes, and references. This tree is crucial for semantic analysis and code generation. ```json { "$type": "Model", "persons": [ { "$type": "Person", "name": "John"}, { "$type": "Person", "name": "Jane" } ], "greetings": [ { "$type": "Greeting", "person": Reference('#/persons@0') }, { "$type": "Greeting", "person": Reference('#/persons@1') } ] } ``` -------------------------------- ### Define HelloWorld Grammar in Langium Source: https://langium.org/docs/introduction/playground This code defines the grammar for a simple 'HelloWorld' language using Langium's DSL. It specifies the structure for 'Model', 'Person', and 'Greeting' elements, along with terminal rules for identifiers and whitespace. This grammar serves as the foundation for parsing and analyzing text in the defined language. ```langium grammar HelloWorld entry Model: (persons+=Person | greetings+=Greeting)*; Person: 'person' name=ID; Greeting: 'Hello' person=[Person:ID] '!'; hidden terminal WS: /\s+/; terminal ID: /[_a-zA-Z][\w_]*/; hidden terminal ML_COMMENT: /\/\*[\s\S]*?\*\//; hidden terminal SL_COMMENT: /\/\/[^\n\r]*/; ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.