Transforming Delphi code into C# (at syntax level)

Let's take an example, first:

sourceDirectory := './MasteringDelphi6' asFileReference
  
sourceDirectory ensureDeleteAll.
repository := IceRepositoryCreator
		fromUrl: 'https://github.com/MarcoDelphiBooks/MasteringDelphi6.git'
		to: sourceDirectory.
sourceDirectory
  

In addition to sources, we need rewrite rules. We can use a few such rules we can use for demonstrating the transformation of Delphi syntax into C# syntax:

rewritesFile := GtResourcesUtility resourceAtPath:
		  Path * 'feenkcom' / 'gt4smacc' / 'resources' / 'Delphi syntax.rw'.
  

With these in hand, we can now inspect the transformation model:

outputDirectory := './demo'.
SmaCCTransformationToolkitModel new
	loadRewriteFile: rewritesFile;
	inputParserClass: DelphiParser;
	validationParserClass: CSharpParser;
	outputDirectory: outputDirectory;
	createSubdirectories: true;
	files: (DelphiParser sourceFilesIn: sourceDirectory);
	yourself