Harmonia
 Harmonia-Mode User's Guide Printer-Friendly Version  

Supported Languages

Harmonia-Mode's supported languages currently have varying features, analyses, and caveats. This page describes each language in detail.


Cool

Language version

Harmonia-mode supports Cool as used in the UC Berkeley CS164 course offering of Spring 2003.

What it will do

Harmonia will correctly detect all lexical, syntactic, and semantic errors. Syntax highlighting, structural selection, movement, elision and search, are all complete. Semantic context menus are complete, and supports use-def navigation, type introspection, display of class inheritance, and method name resolution.


Java

Language version

Harmonia-mode supports Java 2 v1.4.2 (as shown in The Java Language Specification Second Edition, (James Gosling, Bill Joy, Guy Steele and Gilad Bracha)). Harmonia-mode supports all current versions of the Java class library as of Java 2 v1.4.2.

What it will do

Harmonia will correctly detect all lexical, syntactic and almost all semantic errors. Syntax highlighting, structural selection, movement, elision and search, are all complete. Semantic context menus are complete, and supports use-def navigation (for types, constructors, methods, fields, local variables) and type introspection,

How it works

Harmonia assumes the standard directory layout defined in Section 7.2.1 of the Java Language Specification.

While Harmonia opens a file, it also loads (in the background) all the other files upon which it depends. The first time ever that it does so, it caches the semantic data. Therefore, you should expect a much longer delay the first time Harmonia consults a particular library file. Harmonia provides a read-only semantic data cache for the JDK version 1.4.2. If Harmonia-Java looks for a file and does not find it, but it is present in the read-only cache, the cache file is used.

The directory "." (i.e. the current directory), does not make much sense when you are in an editor. Therefore, the directory "." is interpreted as the directory containing the particular file being examined if it is not in a named package; otherwise it is the directory up the hierachy as many levels as there are package levels for named packages.

For example, suppose you have a file ~/mycode/Foo.java with the code:

public class Foo {
void m() { new Bar(); }
}

The directory "." will be interpreted as ~/mycode/. Semantics will search this directory for the file Bar.java.

Now suppose you have a file ~/mycode2/myPackage/Foo.java with the code:

package myPackage;
public class Foo {
void m() { new myPackage.Baz(); }
}

The directory "." will be interpreted as ~/mycode2/. Semantics will search this directory for the file myPackage/Baz.java.

This interpretation attempts to approximate the behavior of javac.

At this time, there is no provision for "projects". Thus, all open files are considered for semantic information for all other open files. This can lead to strange results at times, with things being defined when one would not think they ought to be. If something does not seem to be behaving properly, check all other open buffers. Another consequence is that you must manually change classpaths if you have two sets of files with the same classes defined.

Bugs

Harmonia does not check definite assignment and some dataflow information. If you discover any other bugs, please report them with M-x harmonia-report-bug.


Titanium

Language version

Harmonia-mode supports a superset of Titanium, as described in the Titanium Reference Manual 1.11.

What it will do

Harmonia will correctly detect all lexical, syntactic and almost all semantic errors. Syntax highlighting, structural selection, movement, elision and search, are all complete. Semantic context menus are complete, and supports use-def navigation (for types, constructors, methods, fields, local variables) and type introspection.

How it works

Harmonia for Titanium functions similarly to Harmonia for Java, with a few differences.

Harmonia provides a read-only semantic data cache for the TDK version corresponding to version 1.16 of the language reference.

Titanium projects often have files ending in .java. If these files are not in Titanium mode, Harmonia for Titanium will not notice them. To use Java files for Titanium, type M-x harmonia-titanium-mode.

Templates are not type checked beyond information necessary for instantiations, because it is not clear how semantic errors are to be checked and then reported to the user.

The Titanium Reference describes Titanium without nested classes. Harmonia for Titanium is based on Harmonia for Java, and so is a superset of the union of Titanium (based on Java 1.1) and Java 1.4. The Titanium compiler also allows nested classes. Unfortunately, these two versions of nested classes are incompatable in some ways. Please report any incompatability as a bug, as it is unknown all the ways that they differ.

The variables that hold the classpaths for Java and Titanium are different.

Bugs

Harmonia will not cache files containing templates. This is due to compile time constant information from template formals, which is not readily cacheable. Harmonia does not check definite assignment and some dataflow information, nor is single implemented. If you discover any other bugs, please report them with M-x harmonia-report-bug.


C

Language version

Harmonia-mode supports C99 with most GNU extensions.

What it will do

Harmonia will correctly detect all lexical, syntactic and semantic errors. Syntax highlighting, structural selection, movement, elision and search are all complete. Semantic context menus are complete, and support use-def navigation (for types, enums, structs, unions, variables), type introspection, and navigation from 'goto' statements to their targets. In addition, when you move the mouse over an entity in your program, the type of the entity will appear in the modeline.

Preprocessor

Harmonia supports a subset of the C preprocessor through a menu item in the Harmonia-C menu. Before using this for the first time, make sure you have set up the customize variables for the running the C preprocessor on your local computer. To run the preprocessor, pick the menu item Run Preprocessor. Harmonia will execute the preprocessor and insert the contents of #include statements into the buffer (marked invisible and read-only), and will then reanalyze the buffer. Since the #includes are usually very big, Harmonia-Mode will take some time to run its analyses (for the first time).

To see the preprocessed include text in your buffer, pick the menu item, Show Preprocessed Includes. To hide them again, choose the same menu item again. To delete the preprocessed part of the file, pick the menu item, Delete Preprocessed Includes.

If you edit your #include line, for example, by changing <>'s to quotes, or by changing the file that you're loading, the preprocessor information will be out of date. A compiler warning will appear saying that since you changed a #include, semantics is now turned off. You should pick the menu item Rerun Preprocessed Includes to get rid of the preprocessor information and rerun the preprocessor for the up-to-date information.


Scheme

Language version

Harmonia-mode supports R5RS Scheme with MIT Scheme extensions for escape characters within strings. Harmonia-mode does not support keywords (special forms) to be used as identifiers. R5RS discourages this practice, but does not outright forbid it. In addition, Harmonia-mode does not parse/evaluate Scheme define-syntax macros. Lisp-style macros (quasiquote, comma and comma-at) are supported.

What it will do

Harmonia will correctly detect all lexical and most syntactic errors in Scheme. Harmonia does not analyze Scheme semantics.

Bugs

Harmonia-mode allows Scheme definitions (in 'let', 'let*', 'letrec', 'define' and 'lambda') to have a blank body, but does not tell the user that this is illegal Scheme. Future versions of Harmonia-mode will detect this error and issue a warning to the user. Harmonia-mode does not properly count the number of nestings of quasiquote and commas to verify that they match up.

Next Section: Key Bindings