#noindex 처리 과정 Source Program ↓ Lexical Analyzer ... (lexical_analyzer, lexical_analysis) ↓ Tokens ... ([[토큰,token]]) Syntax Analyzer ... (syntactic_analysis) ↓ Tree ... (AST) Intermediate Code Generator ↓ Intermediate Code ... (intermediate_code) // intermediate_representation { https://en.wikipedia.org/wiki/Intermediate_representation } Code Optimizer ... (code_optimization) ↓ Optimized Code Target Code Generator ↓ Object Program ---- rel. [[컴파일러,compiler]] =컴파일러,compiler =,compiler 컴파일러 compiler { Sub: just-in-time_compiler (JIT_compiler) source-to-source_compiler [[Emscripten]] =,Emscripten : [[C언어]] -> [[자바스크립트,JavaScript]] Ggl:Emscripten 구성: // due to libre frontend / backend front-end : source_code { 소스코드 말고 다른번역: 원시코드 } dependent lexical_analyzer / lexical_analysis : lexeme(단순한 어휘소) scanner = tokenizer : [[토큰,token]] 분리. token(의미를 가짐) [[정규식,regular_expression,regex]]을 기반으로 한 DFA deterministic_finite_automaton 을 구현하여 제작됨 (? chk) parser [[파서,parser]]말고 좋은 번역은 없을지.. =,parser . scanner에서 얻은 token을 이용해 [[parse_tree]]를 생성. 이 때 source_code 가 [[신택스,syntax]]에 맞는지 파악할 수 있으므로, WtEn:syntax_analyzer ( WpEn:syntax_analyzer = WpEn:syntactic_analyzer ?? chk) 라고도 부른다. parser의 분류 기준 * code를 : 왼쪽에서 오른쪽으로 해석하는지 / 오른쪽에서 왼쪽으로 해석하는지 * token의 string 유도가 : 왼쪽에서 오른쪽으로 일어나는지 / 오른쪽에서 왼쪽으로 일어나는지 * lookahead { 현재 토큰의 다음에 올 [[토큰,token]]. Ggl:파서+lookahead Naver:파서+lookahead Bing:파서+lookahead } 를 최대 몇 개 고려해 설계되는지 * 어떻게 실행되는지 등의 기준에 따라 몇 가지로 분류 가능. parser의 분류 * recursive descendant parser // Ndict:"recursive descendant parser" Bing:"recursive descendant parser" Ggl:"recursive descendant parser" [[parse_tree]]를 top-down으로 [[재귀호출,recursive_call]]해가며 [[순회,traversal]]하는 parser. 코딩하기 간단하다는 장점 / [[error_chaining]] =,error_chaining . error_chaining (DEL OK) { '''error chaining''' 실제 오류는 n번 일어났지만 상위 단계의 문법에서도 오류가 있다고 처리되어 한 오류에 대하여 여러 번의 오류 알림이 일어나는 현상[* Libre:컴파일러] Up: [[에러,error]] ~~WtEn:error_chaining~~ ~~WpEn:Error_chaining~~ x ([[Date(2023-08-29T07:56:35)]]) Naver:"error chaining" Ggl:"error chaining" Bing:"error chaining" "error chaining" } 현상을 처리하기 힘들다는 단점. dddddddddddddddddddd back-end : machine dependent Cmp: [[인터프리터,interpreter]] =인터프리터,interpreter =,interpreter 인터프리터 interpreter { [[scripting_language]]{}는 [[컴파일러,compiler]]보단 이걸로 작성되는 경우가 많다. - 컴파일 속도로 인한 REPL의 [[지연,delay]], ... +? [[JIT_compilation]]때문에 컴파일러와 인터프리터의 기술적(? 정확히) 경계는 흐려지는 경향이 있다. ... Ndict:인터프리터 Bing:인터프리터 Ggl:인터프리터 } [[VG:컴파일러,compiler]] http://www.linfo.org/compiler.html https://librewiki.net/wiki/컴파일러 ... Ndict:컴파일러 Bing:컴파일러 Ggl:컴파일러 } [[code_generation]] / [[code_generator]] intermediate * target * [[dynamic_compilation]] { [[WpKo:동적_컴파일]] = https://ko.wikipedia.org/wiki/동적_컴파일 WpEn:Dynamic_compilation = https://en.wikipedia.org/wiki/Dynamic_compilation } [[dynamic_recompilation]] { WpKo:동적_재컴파일 = https://ko.wikipedia.org/wiki/동적_재컴파일 WpEn:Dynamic_recompilation = https://en.wikipedia.org/wiki/Dynamic_recompilation } [[just-in-time_compilation]] = JIT_compilation (= dynamic_translation (wp)) { MKLINK [[바이트코드,bytecode]] { Sub: [[Java_bytecode]] { https://ko.wikipedia.org/wiki/자바_바이트코드 https://simple.wikipedia.org/wiki/Java_bytecode https://en.wikipedia.org/wiki/Java_bytecode } MKLINK [[intermediate_representation]] https://simple.wikipedia.org/wiki/Bytecode https://en.wikipedia.org/wiki/Bytecode } WpKo:JIT_컴파일 = https://ko.wikipedia.org/wiki/JIT_컴파일 "JIT 컴파일(just-in-time compilation) 또는 동적 번역(dynamic translation)은 프로그램을 실제 실행하는 시점에 기계어로 번역하는 컴파일 기법" [[WpSimple:Just-in-time_compilation]] = https://simple.wikipedia.org/wiki/Just-in-time_compilation [[WpEn:Just-in-time_compilation]] = https://en.wikipedia.org/wiki/Just-in-time_compilation } ---- Sources 처리과정: 최린 컴구 slide #2 p5