Skip to content
Snippets Groups Projects
Commit f678494b authored by Kia's avatar Kia
Browse files

finished pseudocode

parent 7a0bc336
No related branches found
No related tags found
No related merge requests found
......@@ -309,6 +309,7 @@ if __name__ == '__main__':
# Special case 1: k is T_ij, and thus x_ijk is the last symbol in the production rule.
# Special case 2: The symbol x_ijk is a terminal symbol.
# The exhaustive case analysis is as follows.
# /----------------------------------------------------------\
# |X_ijk is a terminal symbol | X_ijk is a nonterminal symbol|
......@@ -325,6 +326,39 @@ if __name__ == '__main__':
# | Fprim(i, j, k+1, N-1) | symbols in the subset of rule|
# \----------------------------------------------------------/
# We also note that for the degenerate case N=0, we always can and must return the empty array []
# In pseudocode (taken from the paper, with the correction that on top of page 5
# the "if N==0 then return [1]" seems like it should be "if N==1 then return [1]"):
# Fprim(i, j, k, N):
# if (N==0) return []
# if X_ijk is a terminal:
# if k==T_ij:
# # CASE A
# if N==1 return [1], else return [0]
# if k != T_ij:
# # CASE B
# return [sum(Fprim(i, j, k+1, N-1))]
# else if X_ijk is a nonterminal:
# if k=T_ij:
# # CASE C
# return [sum(Fzero(index of nonterminal at index k, N))]
# if k != T_ij
# # CASE D
# return [sum(Fzero(index of nonterminal at index k, L)) *
# sum(Fprim(i, j, k+1, N-L)) for L = [1, N - T_ij + k]]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment