Faculty of Information Technology Programming Languages and Systems
Skip to Content
QUT Home FIT Home PLAS Home Projects People Wiki Contacts
 
     

Functional Mini Component Pascal (FMCP)

   

FMCP

Functional Mini Component Pascal (FMCP) is the simplest of the MCP formalisations. It forms the basis of the subsequent MCP versions and introduces a number of important concepts that are extended and developed in the more complex languages. FMCP can be seen as a 'minimal functional core' of Component Pascal.

FMCP is heavily influenced by Featherweight Java. Many of the conventions and shorthand used in Featherweight Java -- such as the use of a fixed, globally-accessible class table -- are adapted for in the FMCP type rules. However, as well as adapting the definitions and type rules from Featherweight Java, we have also decided to model certain aspects of Component Pascal that give the language its unique 'flavour' -- such as the record extensibility modifier and the restriction on recursive value types.

Like Featherweight Java and Baby IL with Generics, FMCP is intended to be both a subset of its parent language and purely functional. However, the lack of a 'new record value' construct in Component Pascal means that FMCP is not quite a `pure' subset of Component Pascal. For example, Java allows anonymous object creation expressions of the form "new Object()", whereas there is no equivalent expression in Component Pascal. Therefore in FMCP we add a "NEW R(...)" expression in order to ensure that the language is purely functional.

Language features

FMCP supports the following features:

  • Record type declarations;
  • Record subtyping;
  • INTEGER and BOOLEAN primitive types;
  • Methods bounds to IN receiver types;
  • Record field projection; and
  • A "NEW R(...)" record instantiation expression.

As well as the NEW R(...) expression, there are a few other additions and simplifications of Component Pascal language features. Since FMCP does not support record pointer types, the receiver type of methods is always an IN record value type. This is a simplification of the Component Pascal language requirement that a receiver type may be 'a VAR or IN of record type T or a value parameter of type POINTER TO T (where T is a record type)' (from the CP language report). Also, for the sake of simplicity, the receiver is always bound to the variable "this".

The Component Pascal requirement that "the result type of a procedure can be neither a record nor an array" is also removed - in FMCP, the return type of a method can be a record value type.

We do not consider casting in FMCP, as the Component Pascal does not possess a Java or C#-style cast expression (for example, "(Bar)new Foo()"), and attempting to adapt the Component Pascal WITH construct for a functional language would be somewhat inelegant. Casts are considered in the next MCP language, Imperative MCP.

PLAS
Projects
  ActiveSheets
  Bioinformatics
  ConcernMaps
  ELP
  ELP.NET
  G2 Cluster Computing
  Generics
    Mini Component Pascal
      Background
      FMCP
      Metavariables etc
        Abstract syntax
        Type rules
        Auxiliary definitions
      Example program
      IMCP
      IMCPI
      IMCPG
      Cardelli type inferencer
      Online compilers
  Gardens Point Component Pascal
  Gardens Point Flow
  Gardens Point Modula
  Gardens Point Service Language
  Language Processing Tools
  Mentok
  Metaphor
  Mobilizer
  RikWik
  Ruby.NET
People
Wiki
Contacts