Skip to content

Latest commit

 

History

History
21 lines (16 loc) · 1.07 KB

File metadata and controls

21 lines (16 loc) · 1.07 KB

Algorithm

First ( )

  • Step 1: Start

  • Step 2: Check if the character is lowercase or it is an Epsilon.

  • Step 3: If step 2 is true stop else continue

  • Step 4: For any character of the start of the LHS that matches with the input character do step 5 to step on the first character of it's RHS

  • Step 5: If it is an epsilon add it to the result

  • Step 6: If it is the same stop

  • Step 7: If it is lowercase add it to the result set

  • Step 8: If it is uppercase find the first of that character.

  • Step 9: stop

Follow ( )

  • Step 1:If the input character is the first non-terminal of the production add '$' to te list.

  • Step 2: For any character on the LHS of the productions that matches with the input character do Step 3 and Step 4

  • Step 3: If the next character is end of line find the follow() and the non-terminal on it's LHS is not the same find the follow() of that non-terminal

  • Step 4: If the next character is not the end of line find the first() of that character.