私はflex/bisonを使ってC++スキャナ/パーサーを生成する趣味プロジェクトに取り組んでいます。なぜなら、数え切れないほどの数の解析オブジェクトがあるからです。解析自体は恥ずかしいほど平行な問題です。私は準備ができてすぐに実行できるスキャナ/パーサーオブジェクトをプールし、それらを並列に実行させたいと思います。生成された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++ Bison構文解析器の再入:私は、この問題に関する私の懸念を行っている、バイソンの静的クラスメンバーのカップルは、パーサーヘッダファイルを生成しましたか?
非常に良い点!配列自身がconstか、arrayの要素がconstかどうか私はこれらを区別するためにC++リファレンスを見つける必要があります。 –
C++配列(C配列など)のサイズを変更できないため、配列がconstで、配列の要素がconstであることに違いはありません。 – rici
あなたの答えをありがとう。私はC++ Primのconst章を見直しました。あまりにも長い時間Javaの世界に住んでいて、これはほとんど忘れてしまった。 –