Yacc/Lex Tools v0.2
#yacc #lex #tools (part 2)
In my previous post "Languages and Translators with Visual Studio" I explained how to add a parser to your C# project using the tools GPPG and GPLEX to compile the files YACC and LEX to generate respectively the parser and its scanner.
In the previous post I have illustrated how to modify the project file by hand after installing the NuGet package YaccLexTools.
The package "YaccLexTools" has been updated and from version 0.2 is no longer necessary to manually edit the XML tags of the project file. With this new version you can manage everything thanks to new PowerShell Cmd-Let from the "Package Manager Console" in Visual Studio.
For example, to add a parser to your project you will just need to run the command:
PM> Add-Parser MyLanguage
This command will create all files and settings required to compile YACC and LEX files.
If you want to specify a custom namespace you can run the following command whose second parameter is the namespace:
PM> Add-Parser MyLanguage Sample.NameSpace
To remove the settings for a parser created in the project you can use the following command:
PM> Remove-Parser MyLanguage
This command will not remove files, but only the settings for the specified parser. The files must be removed manually.
Finally, included in the package is a working example to interpret calculus expressions. To add it to the project, just use the command
In this post were shown the simplifications implemented in the new version of the NuGet package YaccLexTools for the management of parsers within C# projects.
With the hope that these updates are useful to those who already use the package and all of those who will use it,
- GPPG original repository: github.com/k-john-gough/gppg
- GPLEX original repository: github.com/k-john-gough/gplex
- Yacc/Lex Tools nuget package: nuget.org/packages/YaccLexTools
- Yacc/Lex Tools project repository: github.com/ernstc/YaccLexTools
This post has been republished from my previous blog (ecianciotta-en.blogspot.com/2013/08/yacclex..).