저는 C++ 스캐너/파서를 생성하기 위해 flex/bison을 사용하는 취미 프로젝트 작업을하고 있습니다. 파싱 개체가 엄청나게 많기 때문입니다. 파싱 자체는 당황 스럽지만 병렬적인 문제입니다. 나는 ready-to-run 스캐너/파서 오브젝트를 풀에 넣고 병렬로 실행시키고 싶다.생성 된 C++ Bison 파서가 재진입입니까?
나는 Flex와 Bison의 공식 문서를 읽고 그 생성 된 코드를 훑어 보았다.
Flex 문서와 그 코드에서 생성 C++ 스캐너가 재진입한다는 것을 확인할 수 있습니다.
그러나 나는이 사실을 Bison 문서에서 확인하기가 어렵습니다. Bison에서 재진입 C 파서를 작성하는 방법을 설명하는 문서가 있습니다. 그러나 C++ 구문 분석기를 빌드하면 명시 적으로 암시하지는 않지만 재진입 성이 있습니다.
// Tables.
// YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
// STATE-NUM.
static const short int yypact_[];
// YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
// Performed when YYTABLE does not specify something else to do. Zero
// means the default is an error.
static const unsigned char yydefact_[];
// YYPGOTO[NTERM-NUM].
static const signed char yypgoto_[];
// YYDEFGOTO[NTERM-NUM].
static const signed char yydefgoto_[];
// YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
// positive, shift that token. If negative, reduce the rule whose
// number is the opposite. If YYTABLE_NINF, syntax error.
static const short int yytable_[];
static const short int yycheck_[];
// YYSTOS[STATE-NUM] -- The (internal number of the) accessing
// symbol of state STATE-NUM.
static const unsigned char yystos_[];
// YYR1[YYN] -- Symbol number of symbol that rule YYN derives.
static const unsigned char yyr1_[];
// YYR2[YYN] -- Number of symbols on the right hand side of rule YYN.
static const unsigned char yyr2_[];
생성되어 C++ 들소 파서 재진입 :이 문제에 나를 걱정하게하는 들소의 정적 클래스 멤버의 몇 파서 헤더 파일을 생성 발견?
아주 좋은 점! 배열 자체가 const이거나 배열 요소가 const 인 것을 의미합니까? 나는 이것들을 구별하기 위해 C++ 레퍼런스를 찾을 필요가있다. –
C 배열과 같은 C 배열은 크기를 조정할 수 없으므로 배열이 const이고 배열의 요소가 const 일 때 차이가 없습니다. – rici
답변 해 주셔서 감사합니다. C++ Primer에서 const 장을 검토했습니다. 자바 세계에 너무 오래 살아, 나는 이것을 거의 잊었다. –