scale.frontend
Class SourceLanguage

java.lang.Object
  extended by scale.frontend.SourceLanguage
Direct Known Subclasses:
SourceC, SourceFortran

public abstract class SourceLanguage
extends java.lang.Object

An abstract class for supporting multiple source languages.

$Id: SourceLanguage.java,v 1.1 2006-12-05 21:02:07 burrill Exp $

Copyright 2006 by the Scale Compiler Group,
Department of Computer Science
University of Massachusetts,
Amherst MA. 01003, USA
All Rights Reserved.

This class contains methods which define certain characteristics about the source language. The compile needs to know about specific source language details to generate valid code.


Field Summary
static boolean cColumnMajor
          Array ordering is column major
static boolean cGarbageCollected
          Java is an example of a garbage-collected memory management language.
static boolean cInsensitive
          The language is case-insensitive.
static boolean cRowMajor
          Array ordering is row major.
static boolean cSensitive
          Implemenations of the generation interface are required to handle both case sensitive and insensitive identifiers.
static boolean cUserManaged
          These attributes specify how dynamic memory is managed by the source language.
 
Constructor Summary
SourceLanguage()
           
 
Method Summary
abstract  int arrayIndexOrigin()
          Return the array index origin for the source language.
abstract  boolean arrayOrdering()
          Specifies the way that arrays are laid out.
 boolean classFieldOrderMatters()
          Return true if the order of class fields in memory matters.
abstract  java.lang.String getLanguageId()
          Return the string associated with this source language.
 boolean isCaseSensitive()
          Return true if identifiers are case sensitive.
 boolean isFortran()
          Return true if the source langauge is Fortran.
 boolean isMemUserManaged()
          Return true if the lanuage relies on user-written memory management.
abstract  boolean mainFunction()
          Returns true if the source language defines "main" (e.g, C).
 boolean mathodOrderMatters()
          Return true if the order of class methods in the virtual table matters.
abstract  boolean nameMangle()
          Returns true if names need to be mangled (Function Name Encoding).
abstract  ParameterMode parameterPassing(Type t)
          Specifies the parameter passing mode used by default.
 boolean recordFieldOrdermatters()
          Return true if the order of record fields in memory matters.
 void setClassFieldOrderRule(boolean orderMatters)
          Specify if the order of class fields in memory matters.
 void setIdentifierCase(boolean cs)
          Specify if the language is case sensitive.
 void setMemoryManagement(boolean mm)
          Specify the memory management used by the language.
 void setMethodsRule(boolean methodsMatter)
          Specify if the order of class methods in the virtual table matters.
 void setRecordFieldOrderRule(boolean orderMatters)
          Specify if the order of record fields in memory matters.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cRowMajor

public static final boolean cRowMajor
Array ordering is row major.

See Also:
Constant Field Values

cColumnMajor

public static final boolean cColumnMajor
Array ordering is column major

See Also:
Constant Field Values

cSensitive

public static final boolean cSensitive
Implemenations of the generation interface are required to handle both case sensitive and insensitive identifiers. The default is case sensitive. We could have required the front end to homogenize case for case insensitive languages; however, this information may prove vital to debuggers.

The language is case-sensitive.

See Also:
Constant Field Values

cInsensitive

public static final boolean cInsensitive
The language is case-insensitive.

See Also:
Constant Field Values

cUserManaged

public static final boolean cUserManaged
These attributes specify how dynamic memory is managed by the source language.

C++ is an example of a user-managed memory management language.

See Also:
Constant Field Values

cGarbageCollected

public static final boolean cGarbageCollected
Java is an example of a garbage-collected memory management language.

See Also:
Constant Field Values
Constructor Detail

SourceLanguage

public SourceLanguage()
Method Detail

arrayOrdering

public abstract boolean arrayOrdering()
Specifies the way that arrays are laid out. Arrays are either laid out in row major order or column major order.
Row major means that the last subscript varies most rapily.
Column major means that the first subscript varies most rapidl.

Returns:
true if the language uses row major order.

arrayIndexOrigin

public abstract int arrayIndexOrigin()
Return the array index origin for the source language. (For example, C starts at 0 while in Fortran they start at index 1.


parameterPassing

public abstract ParameterMode parameterPassing(Type t)
Specifies the parameter passing mode used by default. For example, pass by value. The parameter passing mode may depend upon the type of the actual parameter.

Parameters:
t - the type of the actual parameter
Returns:
the passing mode for the parameter
See Also:
FormalDecl

nameMangle

public abstract boolean nameMangle()
Returns true if names need to be mangled (Function Name Encoding).


mainFunction

public abstract boolean mainFunction()
Returns true if the source language defines "main" (e.g, C).


getLanguageId

public abstract java.lang.String getLanguageId()
Return the string associated with this source language.


isCaseSensitive

public boolean isCaseSensitive()
Return true if identifiers are case sensitive.


setIdentifierCase

public void setIdentifierCase(boolean cs)
Specify if the language is case sensitive.


isMemUserManaged

public boolean isMemUserManaged()
Return true if the lanuage relies on user-written memory management. C++ is an example of a user-managed memory management language.


setMemoryManagement

public void setMemoryManagement(boolean mm)
Specify the memory management used by the language.

Parameters:
mm - is true if the language relies on user-written memory management. C++ is an example of a user-managed memory management language.

setRecordFieldOrderRule

public void setRecordFieldOrderRule(boolean orderMatters)
Specify if the order of record fields in memory matters.


recordFieldOrdermatters

public boolean recordFieldOrdermatters()
Return true if the order of record fields in memory matters. Java is an example of a language where the order does not matter.


setClassFieldOrderRule

public void setClassFieldOrderRule(boolean orderMatters)
Specify if the order of class fields in memory matters.


classFieldOrderMatters

public boolean classFieldOrderMatters()
Return true if the order of class fields in memory matters. Java is an example of a language where the order does not matter.


setMethodsRule

public void setMethodsRule(boolean methodsMatter)
Specify if the order of class methods in the virtual table matters.


mathodOrderMatters

public boolean mathodOrderMatters()
Return true if the order of class methods in the virtual table matters. Java is an example of a language where the order does not matter.


isFortran

public boolean isFortran()
Return true if the source langauge is Fortran.