package nafi.grammar

import nafi.grammar.ast.NafiFile
import nafi.grammar.ast.toAst
import org.antlr.v4.runtime.ANTLRInputStream
import org.antlr.v4.runtime.CommonTokenStream

object NafiParserFacade {
    fun parse(code: String): NafiFile {
        val inputStream = ANTLRInputStream(code)
        val lexer = NafiLexer(inputStream)
        val tokenStream = CommonTokenStream(lexer)
        val parser = NafiParser(tokenStream)
        return parser.nafiFile().toAst()
    }
}
