Finding First and Follow in Top Down Parsing

冷暖自知 提交于 2021-02-11 14:51:12

问题


I have a set of grammar and I need to find the First and Follow from it. So far I've managed to make the First, but now I'm confused as to how to make the Follow.

The set of grammar that I tried to solve:

E -> -E | (E) | VT
T -> -E | ε
V -> id L
L -> (E) | ε

The First that I've come up with. If something's wrong, please inform me:

First (E) = -, (, id
First (T) = -, ε
First (V) = id
First (L) = (, ε

Here's the Follow that I've managed to gather up so far:

Follow (E) = $, )
Follow (T) = $, )
Follow (V) =
Follow (L) =

Right now I'm struggling to find the Follow for (V). And I'm certain once I find the Follow for (V), then I can find the Follow for (L). How do I find the Follow for (V) and what is the Follow for (V)?

来源:https://stackoverflow.com/questions/64841654/finding-first-and-follow-in-top-down-parsing

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!