Replies: 4 comments
-
|
5장 코드표현
구문 트리: 표현식을 트리 모양으로 표현. 파스 트리에서 모든 문법 프로덕션 하나하나가 트리의 노드가 되고, AST에서는 불 필요한 프로덕션을 제거함. 표현식 문제:
|
Beta Was this translation helpful? Give feedback.
-
|
소스 코드 -> 토큰 ->컨텍스트 자유 문법(CFG(Context-Free Grammar)) -> 구문 트리(syntax tree) 프로덕션(prodection) -> 문법 규칙 protein -> crispiness "crispy" "bacon" ; |
Beta Was this translation helpful? Give feedback.
-
컨텍스트 자유 문법(Context Free Grammar)
구문 트리
트리 다루기
|
Beta Was this translation helpful? Give feedback.
-
5.1 컨텍스트 자유 문법형식문법 : 알파벳이라는 원자적 조각들의 집합을 받아 문법에 있는 문자열의 집합을 정의
문법 규칙(production) : 무한한 문자열을 열거하기 위해서 유한한 규칙 집합을 만드는 규칙 파생어(derivation) : 규칙에 맞게 생성된 문자열, 헤드와 바디로 구성 터미널(terminal) : 문법의 알파벳에 있는 글자다? 리터럴 값? 넌터미널(nonterminal) : 다른 문법 규칙을 가리키는 기명참조다. postfix : * 0회 이상 반복, + 1회 이상 반복, ? 0이거나 1회만 록스 표현식 문법
5.2 구문 트리 구현문법이 재귀적이라서 자료구조는 트리 모양을 뛰게 됨. 구문 트리라고 함 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Crafting Interpreters - 로버트 나이스트롬의 인터프리터 in Java, C
5장 코드 표현
Logs start
Beta Was this translation helpful? Give feedback.
All reactions