# Ruby 파서 재작성 하기

> Clean Markdown view of GeekNews topic #9395. Use the original source for factual precision when an external source URL is present.

## Metadata

- GeekNews HTML: [https://news.hada.io/topic?id=9395](https://news.hada.io/topic?id=9395)
- GeekNews Markdown: [https://news.hada.io/topic/9395.md](https://news.hada.io/topic/9395.md)
- Type: news
- Author: [xguru](https://news.hada.io/@xguru)
- Published: 2023-06-15T10:02:01+09:00
- Updated: 2023-06-15T10:02:01+09:00
- Original source: [railsatscale.com](https://railsatscale.com//2023-06-12-rewriting-the-ruby-parser/)
- Points: 10
- Comments: 0

## Topic Body

- Shopify가 YARP라는 새로운 루비 파서를 개발   
- 현재 수준으로, Shopify/GitHub 의 메인 코드 및 RubyGems의 인기 탑100 젬들을 똑같이 파싱 가능  
- CRuby에 머지 승인됨  
- CRuby 기존 파서는 대략 4가지로 문제점 분류 가능   
  - 유지보수성: 문서가 없고, 복잡해서 변경이 어려움   
  - 오류 허용성: 약간의 허용 오차는 있지만, 사소한 오류에도 구문트리가 생성되지 않음   
  - 이식성: 파서가 CRuby 내부와 깊게 연결되어서 다른 도구에서 사용이 불가능   
  - 성능: 고급 최적화 기술 도입이 어려움   
- YARP 개발   
  - C로 작성   
  - 손으로 작성한 Recursive Descent Parser(요즘 주요 언어들의 트렌드임. gcc/golang 도 Bison에서 바꿨음)  
  - CRuby와 동일한 신택스 트리를 유지하려고 했지만, 자체 트리를 설계하는 것으로 결정   
  - Shopify의 5만개 Ruby 파일을 4.49초 만에 파싱 가능(피크시 메모리 10.94Mb)  
- 앞으로   
  - 다양한 Ruby 런타임에 YARP를 연동할 예정   
  - 속도, 메모리 사용량, 정확성을 계속 개선할 예정   
  - Matz 와 CRuby 팀이 Ruby 3.3(올 12월 릴리즈 예정)에 라이브러리로 포함하기로 동의   
-  YARP: Yet Another Ruby Parser

## Comments



_No public comments on this page._
