This section describes all the steps necessary to create your first lexer and first parser using Alpag.
Alpag can generate a combined lexer-parser, but, if desired, a lexer alone or parser alone can be generated as well. Examples in this section follow the later approach.
Two separate subchapters describe creation of just the lexer and just the parser. Both describe entire process of preparing input for Alpag starting from scratch. Because of this, some information in both chapters is repeated.
Make sure Alpag is present your system. Since Alpag comes without installer, you must install it manually:
To install Alpag extension for Visual Studio double click AlpagExtension.vsix file that came with your version of Alpag. If .vsix files are associated in your system with VSIX Installer you should see a message box asking you to approve installation of extension. Follow messages on the screen to complete installation.
If double clicking .vsix file has no effect, you must invoke VSIX Installer manually.
First you must locate VSIXInstaller.exe that comes with your copy of Visual Studio.
If Visual Studio is installed in directory:
then location of VSIXInstaller.exe is most likely:
Invoke VSIXInstaller.exe from command line giving AlpagExtension.vsix as the only argument (preferably using full paths of both installer and extension), like:
Follow the instructions displayed by VSIX Installer.
If there are multiple installations of Visual Studio in the system, VSIX Installer should list all of them asking where to add AlpagExtension. Note however that VSIX Installer is always associated with particular installation of Visual Studio and it may be unable to locate other, especially newer, versions. So it is best to use the copy of VSIX Installer associated with this version of Visual Studio where you want to install the extension.
Restart Visual Studio if it is running.
After restarting you should see Alpag extension listed in Visual Studio Extension Manager (in Tools/Extension Manager menu). In Options window (menu Tools/Options… section Environment/Fonts and Colors ) you should be able to configure syntax highlighting for Alpag files.
Try creating a text file with .alp extension. Enter line starting with valid Alpag commands like %option or %ld. If extension was installed property you should see these commands highlighted with a different color.