[go: nahoru, domu]

본문으로 이동

ANTLR: 두 판 사이의 차이

위키백과, 우리 모두의 백과사전.
내용 삭제됨 내용 추가됨
TedBot (토론 | 기여)
잔글 봇: 틀 이름 및 스타일 정리
1 개의 출처 구조, 0 개의 링크를 깨진 것으로 표시) #IABot (v2.0.8
63번째 줄: 63번째 줄:
== 외부 링크 ==
== 외부 링크 ==
* {{공식 웹사이트|www.antlr.org}}
* {{공식 웹사이트|www.antlr.org}}
* [http://tunnelvisionlabs.com/products/demo/antlrworks ANTLRWorks]
* [http://tunnelvisionlabs.com/products/demo/antlrworks ANTLRWorks] {{웨이백|url=http://tunnelvisionlabs.com/products/demo/antlrworks |date=20150217084519 }}
* [http://www.placidsystems.com/antlrstudio.aspx ANTLR Studio]
* [http://www.placidsystems.com/antlrstudio.aspx ANTLR Studio]



2021년 1월 17일 (일) 20:24 판

ANTLR
원저자Terence Parr
발표일1992년 2월
안정화 버전
4.7 / 2017년 3월 30일(7년 전)(2017-03-30)
저장소
프로그래밍 언어자바
플랫폼크로스 플랫폼
라이선스BSD 라이선스
상태개발 중
웹사이트www.antlr.org

컴퓨터 기반 언어 인식에서 ANTLR(앤틀러, Another Tool For Language Recognition)는 구문 분석을 위해 LL(*)을 사용하는 파서 발생기이다. ANTLR은 1989년 처음 개발된 PCCTS(Purdue Compiler Construction Tool Set)의 뒤를 이으며 현재 개발이 진행 중이다. 유지보수는 샌프란시스코 대학교Terence Parr 교수가 맡고 있다.

다음의 예에서 ANTLR의 파서는 "1 + 2 + 3"의 식의 합의 형태로 표시할 수 있다:

 // Common options, for example, the target language
 options
 {
  language = "CSharp";
 }
 // Followed by the parser
 class SumParser extends Parser;
 options
 {
   k = 1; // Parser Lookahead: 1 Token
 }
 // Definition of an expression
 statement: INTEGER (PLUS^ INTEGER)*;
 // Here is the Lexer
 class SumLexer extends Lexer;
 options
 {
   k = 1; // Lexer Lookahead: 1 characters
 }
 PLUS: '+';
 DIGIT: ('0'..'9');
 INTEGER: (DIGIT)+;

다음의 나열은 프로그램 내 파서 호출을 증명한다:

 TextReader reader;
 // (...) Fill TextReader with character
 SumLexer lexer = new SumLexer(reader);
 SumParser parser = new SumParser(lexer);

 parser.expression();

같이 보기

외부 링크