variation in code generation, using ANTLR4 parse tree visitors
问题 I am writing transpiler ( myLang -> JS) using ANTLR (javascript target with visitor). Focus is on target code generation part, from the parse tree. As in, how to deal with language source codes variations. To make question clearer, consider two variations below - source#1: PRINT 'hello there' source#2: varGreeting = 'hey!' PRINT varGreeting In case 1, I deal with string. While in case 2, it's a variable. JS target code then needs to be different (below). case 1 with quotes, case 2 without.