[pseudo] NFC, fix some typos.

This commit is contained in:
Haojian Wu 2022-02-11 15:34:40 +01:00
parent d84dedc7d3
commit 8fee667d31
2 changed files with 4 additions and 4 deletions

View File

@ -83,7 +83,7 @@ struct Rule {
// We occupy 4 bits for the sequence, in theory, it can be at most 2^4 tokens
// long, however, we're stricter in order to reduce the size, we limit the max
// lenth to 9 (this is the longest sequence in cxx grammar).
// length to 9 (this is the longest sequence in cxx grammar).
static constexpr unsigned SizeBits = 4;
static constexpr unsigned MaxElements = 9;
static_assert(MaxElements <= (1 << SizeBits), "Exceeds the maximum limit");
@ -167,7 +167,7 @@ struct GrammarTable {
// The rules are sorted (and thus grouped) by target symbol.
// RuleID is the index of the vector.
std::vector<Rule> Rules;
// A table of terminals (aka tokens). It correspond to the clang::Token.
// A table of terminals (aka tokens). It corresponds to the clang::Token.
// clang::tok::TokenKind is the index of the table.
std::vector<std::string> Terminals;
// A table of nonterminals, sorted by name.

View File

@ -18,7 +18,7 @@
//
// LRGraph can be constructed for any context-free grammars.
// Even for a LR-ambiguous grammar, we can construct a deterministic FSA, but
// interpretation of the FSA is nondeterminsitic -- we might in a state where
// interpretation of the FSA is nondeterministic -- we might in a state where
// we can continue searching an handle and identify a handle (called
// shift/reduce conflicts), or identify more than one handle (callled
// reduce/reduce conflicts).
@ -116,7 +116,7 @@ struct State {
//
// Intuitively, an LR automaton is a transition graph. The graph has a
// collection of nodes, called States. Each state corresponds to a particular
// item set, which represents a condition that could occur duing the process of
// item set, which represents a condition that could occur during the process of
// parsing a production. Edges are directed from one state to another. Each edge
// is labeled by a grammar symbol (terminal or nonterminal).
//