BETA.Net/BETA.Java README

Notes for the preliminary .NET and Java VM versions of the BETA language compiler.

PLEASE READ SECTIONS A, B, C, D BEFORE USING ANY OF THIS!

DISCLAIMER

This is a VERY PRELIMINARY release. The compiler and the generated programs may fail fatally in various situations. USE AT YOUR OWN RISK!

A. Prerequisites

A1. Microsoft .NET Framework

The current implementation has been tested with version 1.0 and 1.1 of the Microsoft .NET Framework.
Furthermore most programs work with ROTOR.
  1. The Microsoft .NET Framework Final version or ROTOR must be installed before using the .NET version of the BETA compiler.

A2. Java JDK

  1. The Java JDK version 1.4.2 or later must be installed before using the Java VM version of the BETA compiler. Java 1.5 has not been tested.

B. Installation of BETA.Net and BETA.Java

  1. Unpack distributed file.
    This distribution contains binary executables for BETA.Net and BETA.java for windows only.
    There is no installer.
    Simply unzip BETA_OOLI-<date>.zip. This will create a directory named BETA_OOLI.
    The compilers nbeta.exe and jbeta.exe resides in the bin subdirectory. Make sure you have the BETA_Net/bin directory in your search PATH, if you want to invoke the compiler from other directories.
  2. Set environment variables.
    You must set the environment variable BETALIB to the location of your BETA_OOLI directory before using the compiler.
    For Java, you must also set the following environment variables: You can set up these environment variables manually in
         Start->Settings->Control Panels->System->Advanced->Environment Variables
    
  3. If you prefer, you can set up these environment variables by using scripts placed in the top directory of the unpacked directory:
    If you are using Windows cmd.exe as shell issue the command
         configuration\cmd_setup.bat
    
    and if you are using Cygwin bash, issue the command
         . configuration/cygwin_bash_setup.sh
    
  4. Example programs reside in the examples subdirectory. Some of the programs are more of the test kind than actual demos. To mention a few of them:
    hello.bet
    The traditional "Hello World" program in BETA
    LL1.bet
    A simple LL1 parser for a small expression language.
    stack.bet, stackBody.bet,stackuser.bet
    A small example showing separation of declaration and implementation using the BETA fragment system.
    The file stack.bet declared the pattern Stack with SLOTs as its implementation. This is pretty much like an interface in Java/.NET.
    The file stackBody.bet is a trivial implementation of the Stack. It could be replaced by another implementation.
    Finally, the file stackuser.bet instantiates and use such a stack. It suffices to compile this file - the compiler will detect dependency on the other files and compile them as well.
    NumList.bet
    An example showing parameterized classes in BETA using virtual inner patterns: A pattern List is declared with a virtual element-type of just object. The pattern NumList inherits from List but furtherbinds the element type to be number, which make the compiler aware that element types in this list now has number type. Thus there is no need for any generics mechanism in BETA - it's all done by general handling of scoping and virtuality!
    beer.bet
    Cheers! Just an implementation generation of the lyrics for the traditional song 99 Bottles of Beer on the Wall using various standard BETA facilities.
    Bclass.bet, BclassUser.java, BclassUser.cs
    A simple BETA class with a few methods.
    The .java and .cs files show how to inherit from this BETA class from Java and C#, respectively (see comments in beginning of these files for instructions).
    See also Cross language support below.
    google.bet
    A BETA program that use the Google web service to make a search from the command line.
    See also Cross language support below.
    Some .NET specific examples include:
    hellographics.bet
    A "Hello World" program using Windows Forms and other graphics.
    An example of inheriting from an external .NET class (System.Windows.Forms.Form) in BETA.
    See also Cross language support below.
    hellobox.bet
    A simple program showing a Windows MessageBox.
    (Jørgen Thyme is the person at Microsoft Denmark who sponsored the initial work on the BETA.Net project).
    Note for ROTOR: The demo programs also compile and work under ROTOR, except - of course - the programs using framework libraries not available in ROTOR; specificly the google programs do not works, since System.Web.Services is not in ROTOR, and the graphics demos fails because the System.Windows libraries are not in ROTOR.

    Some JAVA specific examples include:

    helloapplet.bet
    A "Hello World" applet written in BETA.
    An example of inheriting from an external JAVA class (java.applet.Applet) in BETA.
    See instructions in comment in top of heloapplet.bet.
    See also Cross language support below.
    bpackage.bet
    Example showing how to make the class files generated by the jbeta compile end up in another Java package than the default beta.
    Notice also the file SEE_ALSO.txt which lists various other demonstration programs.

  5. Academic articles describing BETA.Net/BETA.Java are in preparation. Please see documentation/Presentations.html

C. Using the compiler

  1. The compiler generating .NET executables is named nbeta.exe, and the compiler generating java class files is named jbeta.exe.
  2. The compiler is invoked from the commandline in a shell, e.g. from cmd.exe. It is also known to work with cygwin bash [http://www.cygwin.com/setup.exe]
  3. The compiler is invoked by typing
    nbeta foo[.bet]
    or
    jbeta foo[.bet]
    for .NET and JVM, respectively, where foo.bet is a beta source file containing the definition of the program fragment. as indicated, the .bet extension need not be given at the command line.
    likewise for jbeta.
  4. Various options are available for the compiler; to get a list type, e.g.
    nbeta --help
  5. Notice, that the libraries in this package is distributed in source form, which means that the first compilation(s) of will result in compilation af many files. Please be patient with this, it only occurs for the first few files you compile. You may want to use the --noWarn (or simply -w) option for these first compilations to reduce output.
  6. Using the Managed .NET Compiler: The release now includes a bootstrapped managed nbeta with the same functionality as the native nbeta.exe, although much slower.
    It is invoked by typing
    managed-nbeta.exe foo[.bet]
    or
    managed-nbeta.bat foo[.bet]
    The first execution will run the compiler as a .NET CLR managed executable, using the Microsoft .NET environment, whereas the second form (the .bat) file will execute nbeta.exe using the ROTOR clix kick-starter. Both execution forms will run much slower than the native nbeta.exe (about a factor 50 slower for a "free" build of ROTOR) and be rather memory consuming too - these are merely included for demonstration purposes. The major reason for the slowdown is currently believed to be due to the very preliminary implementation of Coroutines, of which the compiler use a lot.
    You man want to compile at least one program with the native nbeta.exe before compiling anything with managed-nbeta to get the basic libraries compiled before playing with managed-nbeta. Also we have seen managed-nbeta.exe crash with System.OutOfMemoryException for some compilations, whereas the same compilation using the ROTOR wrapper managed-nbeta.bat never has failed this way. Seems like a functional difference in .NET and ROTOR.
    We hope to improve the managed performance dramatically in our future work.

D. Known preliminary issues

  1. A few constructs in the BETA language is still not implemented.
  2. The full set of the standard BETA libraries are NOT yet part of this preliminary distribution, since bindings for Java and .NET class libraries has not yet been created for the entire BETA library. The libraries included are only partially implemented.
  3. (Not really a limitation, more an addition to BETA)
    BETA patterns used only as classes can be prefixed with the keyword class and BETA patterns used only as methods can likewise be prefixed with keyword proc. This will reduce the number of generated .NET classes.

E. Using the CLR debugger(s)

  1. For a description of debugging using DbgCLR, see documentation/Debugging.html#dbgclr
  2. For a description of debugging using CorDbg, see documentation/Debugging.html#cordbg
  3. Possibly we will later generate a foo.dln file for DbgCLR.exe

F. Using Visual Studio .NET

  1. For a description of debugging using Visual Studio .NET, see documentation/Debugging.html#vsnet
  2. Possibly we will later generate a foo.sln file for Visual Studio.NET
  3. We are hoping to find time to make a Visual Studio Integration under the VSIP program (http://www.vsipdev.com/).

G. Using jdb

  1. For a description of debugging using the Java debugger jdb, see documentation/Debugging.html#jdb

H. Cross language support

  1. You may use libraries written in BETA in other languages. You just compile the BETA library, using nbeta, and then reference it from the other language. A simple example is in Bclass.bet and BclassUser.cs/BclassUser.java. Compilation statements are given in the start of the C# and Java files.
    NOTICE: The DLLs and class files generated for BETA files reside in the clr and jvm sub directories (to avoid cluttering the source directory).
    As described in the compilation directives you must therefore tell csc/javac where to find the DLL's and class files.
    Also at run-time you must tell the .NET Framework/JVM where to find these DLL's / class files. For .NET this is most easily done by making a config file like BclassUser.exe.config.
    For JVM you specify this using the -classpath option for the Java VM.
    The .NET/Java classes generated from the BETA patterns are not yet fully documented. Academic articles describing BETA.Net/BETA.Java are in preparation, Please see documentation/Presentations.html
  2. BETA code can call code and use types from other languages.
    Currently, before using a class/method in an external non-BETA assembly, it must be declared using the predefined patterns External and ExternalClass. See examples/hellobox.bet, and examples/hellographics.bet for .NET examples.
    See examples/helloapplet.bet for a Java-only example.
    You might also want to study examples/google.bet which use different external classes for .NET and Java using the MDBODY fragment mechanism in the BETA compiler, see examples/google_clrbody.bet and examples/google_jvmbody.bet.
  3. The cross language support is expected to be significantly improved in a later version. E.g. we expect to make the compiler lookup the declarations in external non-BETA assemblies/classes, thus avoiding the need for declaring these manually.
    The current special constructs for supporting cross language support is described in documentation/Special.html

I. Further information

If you have any questions, problems, comments etc. regarding BETA.Net or BETA.Java, please contact [mailto:beta@cs.au.dk].

The latest version of this page is always available at Object-Oriented Language Interoperability