James Kyle의 The Super Tiny Compiler를 JavaScript에서 Python으로 번역하려고합니다.JavaScript 입력 및 종료 방법을 파이썬으로 변환
하지만 난 입력하고 자바 스크립트를 종료 방법이 무엇 이해하는 문제에 봉착 : 나는이 두 가지 방법을 번역 할 수있는 방법
// If there is an `exit` method for this node type we'll call it with the
// `node` and its `parent`.
if (methods && methods.exit) {
methods.exit(node, parent);
}
1)
// If there is an `enter` method for this node type we'll call it with the
// `node` and its `parent`.
if (methods && methods.enter) {
methods.enter(node, parent);
}
2) 파이썬에? 감사합니다.
Here's a link to the Tiny Compiler code
그들이하는 일을 이해하려면, The Super Tiny Compiler에 대해 더 읽고,'enter'와'exit'가 어떻게 정의되는지 살펴 보길 권합니다. 파이썬으로 번역 할 때, 그것들은 두 개의 노드를 취하는 단지 방법 일뿐입니다. Python으로 메소드를 작성할 수 있다면 번역하는 것이 간단합니다. –
입력 및 종료가 Super Tiny Compiler에 정의되어 있다고 생각하지 않습니다. 나는 그들이 D3 JavaScript Library에서 왔다고 믿는다. –
@MarcoLugo D3에서 AST에 적용 할 수있는 방문자를 정의하는 이유는 무엇입니까? D3은 데이터 시각화 라이브러리입니다. – sepp2k