Skip to content

Commit

Permalink
add usage example
Browse files Browse the repository at this point in the history
  • Loading branch information
bachish committed Dec 5, 2024
1 parent 7099f17 commit cd1c800
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions benchmarks/src/main/kotlin/UcfsRunExample.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import org.ucfs.Java8
import org.ucfs.parser.Gll

fun main(){
// get RSM start state
val startState = Java8().rsm
// get linear graph from source code
val text = "package a; class X {}"
val tokens = getTokenStream(text)
// parse (intersect graph and rsm)
val gll = Gll.gll(startState, tokens)
// make sure that sppf isn't empty
assert(gll.parse().first != null) { "can't build sppf" }
}

0 comments on commit cd1c800

Please sign in to comment.