Test cases in antlr grammar file

Test cases in antlr grammar file

2018/02/24 Kernel Programming 0

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 http://www.quantr.hk/nasmweb/ , 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 (https://github.com/antlr/grammars-v4/tree/master/antlr4), so i can build it for sure

read count : 2

Leave a Reply

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