From 02c62636e2bb74d57db09c85890eb89bdf707429 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 1 Jul 2012 20:37:16 -0400 Subject: [PATCH] Added in three short sections explaining grammar --- index.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/index.md b/index.md index a51c15a..ce0e9d4 100644 --- a/index.md +++ b/index.md @@ -344,10 +344,24 @@ Give examples. ### What is an ambiguous grammar? +A gramar is considered to be ambiguous if it provides more than one way to parse a string. + +If we take a look at the grammer below we can see why it would be considered ambigious. + +S -> A* | B* +A -> b | bB +B -> bb | bA + +Now if we look at the string "bb" without the ability to look ahead we could have either parsed this intially as AA or B. Since we could have gone down multiple paths without any look ahead, this is considered to be ambigous grammar. + ### What is a LL(k) grammar? +Grammar is said to be LL{k} if it it can be read from left to right and be non-ambigous when creating a left most derivation with only the ability to look k characters ahead. + ### What is a LR(k) grammar? +Grammar is said to be LL{k} if it it can be read from left to right and be non-ambigous when creating a right most derivation with only the ability to look k characters ahead. + ### What is Backus-Naur Form? ### What is a pushdown automaton?