我现在所拥有的只是互联网。无法安装工具,也不知道如何搜索我的问题。
以下源代码是什么编程语言?
let parse = (S, nfa, str, idx=0) => {
let stack = [nfa]
let shift = () => {
let next = stack[0].next(str.charAt(idx))
if(next.size == 0) return false
stack.unshift( [...next].reduce(plus, zero) )
idx++
return true
}
let reduce = () => {
let reductions = stack[0].done()
if(reductions.size == 0) return false
if(reductions.size > 1) throw "Reduce/Reduce conflict"
let {n, id} = [...reductions][0]
while(0 < n--) stack.shift()
stack.unshift( [...stack[0].next(id)].reduce(plus, zero))
return true
}
while(idx < str.length) {
if(!(shift() || reduce())) return false
}
do {
if([...stack[0].done()].some(
({n,id}) => id == S && n == stack.length-1)) {
return true
}
} while(reduce())
return false
}