# Grammar

The input grammar must respect to the syntax of ANTLR's meta-language. Another Tool for Language Recognition (ANTLR) is a "powerful parser generator that you can use to read, process, execute and translate a structured text or binary files". Next, a brief introduction of the ANTLR meta-language will be offered. Although not every feature of the meta-language will be discussed, the material provided should be sufficient to comprehend the grammar language and how to create one.
  • The ANTLR Lexicon:
    • Comments - Single line (// . . . ), multiline (/*. . . */) and Javadoc-style comments (/**. . . */);
    • Identifiers - Token names and lexer rules must begin with a capital letter, but parser rules must begin with lowercase letters. Uppercase and lowercase letters, numbers, and underscores are permitted;
    • Literals - All literal strings that are encased in single quotes and have one or more characters in length. They may include Unicode escaped sequences as well as escape sequences such as newline ('\n'), carriage return ('\r'), tab ('\t'), backspace ('\b'), and form feed ('\f');
    • Keywords - The list of reserved keywords are: import, fragment, lexer, parser, grammar, returns, catch, finally, mode, options and tokens.
  • The ANTLR Structure:
    • The syntax of a grammar is quite simple: there is a list of declarations (all of which are optional except for the grammar name) followed by a collection of rules.
    • The filename for the grammar X description must be X.g4.
    • The tokens section is used to define certain tokens that were not defined in the lexer but should be included to the overall set.

# Describe Linguistic Properties

There are aspects of programming languages that grammar metrics cannot measure or capture, but which have a huge impact on the support, particularly when it comes to a static analysis tool. In this sense, a domain-specific language (DSL) was created with the goal of describing the features of a programming language that bring positive or negative impact to the moment of support. The Properties Language is used in programming languages to define the substance of linguistic features and paradigms. This language was not created with the intention of acting as documentation for a specific language, but it does include in its design various characteristics and notions that allow for an assessment of its complexity.
  • The language concepts presented are quite explicit, in that the terminology used literally means that name. The phrases in this language are precisely the features of a programming language. Briefly, a reference about the name of the paradigms in which it can be any within a short list created and selected by the author.
  • Regarding the content of each list is one or more items within a paradigm, either a predefined feature or a free one that the user wants to describe. For each of these items, an associated weight (positive or negative) is optionally defined, thus translating the possibility of translating the impact of this element on the processing complexity.