Compiler Tools in C#


This is Version 3.4 of these tools. It requires the .NET Framework to run.

The tools are:

lg.exe
pg.exe
Tools.dll

The documentation is in:

README.txt
Booklet.doc

The source files for the tools are:

AssemblyInfo.cs
genbase0.cs
genbase.cs
lg.cs
olist.cs
parser.cs
pg.cs
pg.lexer
cs0.lexer
cs0.parser
toolcs.bat

The remaining files in this distribution are samples etc.

Rebuilding the tools from the sources:

toolcs.bat rebuilds Tools.dll, lg.exe and pg.exe from the sources in a two-stage bootstrap procedure, described in section 7.7 of the accompanying booklet:

Step 1: generates a Tools.dll that supports lexer generation, using genbase0.cs; creates a preliminary version of the  lexer-generator lg.exe;uses this on pg.lexer and builds a preliminary 
version of pg.exe

Step 2: uses the resulting lg and pg to create class-definition lexer/parser using cs0 scripts
and builds a full version of Tools.dll

During this process, the C# compiler issues a number of warnings about unreachable code. This is a feature of the tools: there is one such warning for each OldAction clause in lexer and parser scripts. The cs0.parser script also has two harmless shift/reduce conflicts.

If you want a version of the library to place in the global assembly cache (gac) proceed as follows:

First prepare all the sources by running toolcs.bat. Then run the script gacvers.bat.
This creates CSTools.dll and links lg and pg to use this.

CSTools.dll is just Tools.dll signed with the key pair sgkey.snk which you will find here, and given the right version number.

The install.bat file places the signed library CSTools.dll in the global assembly cache. This makes executables independent of the dll, but you need to reference a copy of CSTools.dll when creating the executable.

Up Next
    Ebook Download
    View all
    Learn
    View all