Search Posts

Test cases in antlr grammar file

I am developing an Assembler, i think the best way is to embed the test case into the grammer, all those test cases are just one single line of assembly code. But now no way to do this in Antlr grammar. I am thinking to create a maven plugin to pre-process the grammar file. Add my own syntax to the antlr grammar, process that file, extract the test cases, generate a new g4 grammar file. All those extracted test cases will be upload to the testing portal , it then execute nasm to crab all output bytes to cross check with the output bytes from my assembler, make sure the output are the same.

The make that maven plugin to preprocess antlr grammar, it will be the first time i write a “parser of parser”, luckily antlr is well designed and it provide offical its own grammar in java (, so i can build it for sure

Leave a Reply

Your email address will not be published. Required fields are marked *