This is a "PoC" project made to show how easy it is to implement logic on top of LINVAST ASTs and shows all the benefits of LINVAST. The logic is not complete and therefore using it in your own projects is not advised.
Simple imperative AST comparer library written on top of LINVAST. Made to be extensible and manageable long-term. Available as a NuGet package.
Several examples can be found in the directory. One sample will be shown below.
$ linvast cmp
ERROR(S):
A required value not bound to option name is missing.
-v, --verbose Set output to verbose messages.
--help Display this help screen.
--version Display version information.
value pos. 0 Required. Specification path.
value pos. 1 Required. Test source path.$ linvast cmp Samples/swap/valid.c Samples/swap/wrong.c$ linvast cmp Samples/swap/valid.psc Samples/swap/wrong.cSources:
(Note: Overflow is not checked at the moment)
$ linvast cmp Samples/swap/valid.c Samples/swap/refactor.cSteps:
- Create new comparer class in the
LINVAST.Imperative.Comparersnamespace - Extend
ASTNodeComparerBase<T>base class whereTis the type ofASTNodeyou wish to implement
Comparers created in this way will be automatically picked up by ASTNodeComparer class via reflection.
Comparers can (and it is encouraged for them to) use already existing comparers in their logic. Check out some of the already written as an example.