Home > Tard

Tard

Tard is a project mainly written in C++, based on the View license.

Tard; Totally Awesome Rapid Deployment, a BASE jumping term and rather unrelated - but alas, sometimes a weekend project needs a name quick, What remains is a small amount of dusty old code I wrote to experiment with ANTLR, nothing to see here - carr

// --------------------------------------------------------------- // Tard - Totally Awesome Rapid Deployment - Copyright 2005 Jaap Suter // ---------------------------------------------------------------

Tard is an experimental language developed by Jaap Suter. The name of the language comes from a maneuvre in base-jumping where the parachute is tossed up in the air just before the jumper leaves the object. It has nothing to do with the actual language, but a better name was not found.

The language is far from powerful. It was solely intended as a learning exercise to get more experience in writing compilers, as well as satisfying a curiousity about ANTLR and targeting the CLR .NET virtual machine.

// --------------------------------------------------------------- // Tard - The Language // ---------------------------------------------------------------

Tard is a simple language developed using Java, ANTLR, C++ and the CLR. It uses ANTLR and Java to generate a C++ parser and abstract syntax tree factory. These are visited from C++ code to generate Microsoft Intermediate Language (MSIL) targeting the CLR .NET platform. This MSIL can be asssembled by ilasm.exe that ships with the .NET distribution to create an executable that can be run on the CLR virtual machine.

For more information about the language itself, refer to the documentation in the docs directory.

// --------------------------------------------------------------- // Directory Contents // ---------------------------------------------------------------

dist            - target directory for the test-suite executable
doc             - documentation in PDF format
generated_src   - source-code generated by ANTLR
grammar         - grammar specification for ANTLR
include/tard    - all the include files for Tard
project         - contains a Visual Studio 7.1 .NET 2003 project and solution file
src             - contains all source files for Tard
test            - contains the test-suite driver
test/scripts    - contains all Tard test scripts

// --------------------------------------------------------------- // Requirements to build the test-suite // ---------------------------------------------------------------

1. Microsoft Visual Studio 7.1 .NET 2003
2. A .NET distribution with ilasm.exe
3. A Java Runtime that can run ANTLR
4. ANTLR (version 275), in a parallel directory - e.g.,

    some/dir/tard/doc...
    some/dir/tard/include...
    some/dir/tard/...etc...
    some/dir/antlr/275/bin/...
    some/dir/antlr/275/doc/...

// --------------------------------------------------------------- // Getting Started // ---------------------------------------------------------------

To build and run the test-suite, do the following:

1. Find out where on your system the file ilasm.exe resides. Usually
   this is in C:/WINDOWS/Microsoft.NET/Framework/v1.1.4322/ilasm.exe but
   occasionally it could be somewhere else.
2. Open up tests/scripts/path_to_ilasm.ini and make sure it points to the 
   location of where your ilasm.exe is.
3. Open up the solution file: project\test_vc_7_1\test_vc_7_1.sln
4. Open up project->properties->debugging->working_directory and make sure
   it is set to "./test"
5. The include and link directories point to the ANTLR distribution that should
   have come with your Tard distribution. The ANTLR distribution should reside 
   in the same root directory as where the Tard directory starts. In other words.

   some_dir_where_you_unzipped/tard/...
   some_dir_where_you_unzipped/antlr/...

   These paths are setup relative so it should work out of the box. It has been 
   tested on multiple machines in different directories and there were no 
   problems. If the compiler or linker can't find certain headers or libraries
   please make sure the paths are setup okay. If all that fails, please contact
   me at [email protected].

   The ANTLR generated source-code is done as a custom build-step. This can be seen
   by right-clicking on "tard.grammar" in the solution explorer. This should bring
   up the custom build-step menu. Again, these paths point to ANTLR but they are relative
   so they should work out of the box.

 6. Press F7 to build the project. Press F5 to run the test-suite.

 7. Some of the tests wait for user input, so if the test seems to hang, try 
    entering a number and pressing enter.

To use the compiler stand-alone to make your own programs, just link in all the tard source-files, instantiate a compiler, provide an input stream and an output stream, and then assemble the resulting file with your favourite .NET assembler.

// --------------------------------------------------------------- // Troubleshooting // ---------------------------------------------------------------

For all questions, problems and other comments, please send email to [email protected]. I will help out as quick as I can.