Created
May 17, 2023 17:32
-
-
Save brokenpylons/a065b3bafd2a5fd55ab0a5d9e5b189a1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.antlr.v4.runtime.CharStreams | |
import org.antlr.v4.runtime.CommonTokenStream | |
// Implement visitor | |
fun main(args: Array<String>) { | |
val stream = CharStreams.fromStream("1 + 1".byteInputStream()) | |
val lexer = GrammarLexer(stream) | |
val tokens = CommonTokenStream(lexer) | |
val parser = GrammarParser(tokens) | |
val cst = parser.start() | |
val visitor = // ... | |
println(cst.accept(visitor)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment