Context Free Grammar

Context Free Grammar

Creator
Creator
Seonglae ChoSeonglae Cho
Created
Created
2022 Oct 5 3:48
Editor
Edited
Edited
2022 Oct 5 4:13
Refs
Refs
Grammar

CFGs

Ways of specifying PL syntax
A context-free grammar is specified by a Tuple G = (V, T, P, S)
  1. V is variable (non-terminal symbol) set
  1. T is terminal (terminal symbol / Token (at compiler)) set - like alphabet
  1. P is production set - same head can exist math: \subseteq V \times (V \cup U)^*
  1. S is one start symbol (sentence symbol) - math: L(G) = \{w \in T^* \, | \, S \Rightarrow^* w\}
  • Any Regular Languages is CFL
  • process of replacing Non-terminals to terminals
  • where V, T, P is finite set
Context Free Grammar Notion
 
 
Context Free Grammar Usages
 
 
 

Reference

[Study] Context Free Grammar (CFG)
지난 포스트를 통해서 Regular Expression을 NFA->DFA를 거쳐는 일종의 Lexical Analysis을 정리했다. 그러면 이제 수행해야 될 것이 Syntax Analysis가 될 것이다. 그런데 한가지 짚고 넘어가야 될 부분이 있다. 과연 지금까지 다룬 방법으로 사용자가 넣는 모든 입력들을 이 Syntax Analysis를 처리할 수 있냐는 것이다. 예를 들어서 brace {()} 가 있는 구문을 보자 이걸 Regular Expression으로 어떻게 표현할 수 있을까?
[Study] Context Free Grammar (CFG)
 
 
 

Recommendations