Skip to content
This repository has been archived by the owner on Mar 19, 2021. It is now read-only.

shadrina/kt-grammar-tester

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

74 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ANTLR Grammar Testing Tool

Kotlin ANTLR grammar correctness verification by comparing trees created both with ANTLR autogenerated parser and the real parser.

Input Output
Kotlin language source code Parsing and comparison report with ability to check out the subtrees in which the difference was found

Workflow description

  • The KotlinFileContext object is created using the generated by ANTLR tool KotlinLexer and KotlinParser classes. If parsing errors are detected, no further validation occurs
  • The real AST stored in KtFile object is generated using Kootstrap
  • For future analysis the resulting objects are wrapped into auxiliary wrapper classes
  • The comparison is recursive. If a difference in the subtrees is found, the information is stored as an ComparisonError object, and verification continues

Comparison logic

  • There are several ANTLR rules which can be considered as redundant. Redundant rules are created just to simplify the grammar and skipped when verified
  • Our goal is to check if the trees are homeomorphic by smoothing out vertices from the ANLTR-generated parse tree

Grammar source

Source

About

Tree structures analyser

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published