llvm/llvm/utils/TableGen/DFAEmitter.cpp

//===- DFAEmitter.cpp - Finite state automaton emitter --------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// This class can produce a generic deterministic finite state automaton (DFA),
// given a set of possible states and transitions.
//
// The input transitions can be nondeterministic - this class will produce the
// deterministic equivalent state machine.
//
// The generated code can run the DFA and produce an accepted / not accepted
// state and also produce, given a sequence of transitions that results in an
// accepted state, the sequence of intermediate states. This is useful if the
// initial automaton was nondeterministic - it allows mapping back from the DFA
// to the NFA.
//
//===----------------------------------------------------------------------===//

#include "DFAEmitter.h"
#include "Basic/SequenceToOffsetTable.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/UniqueVector.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/TableGen/Record.h"
#include "llvm/TableGen/TableGenBackend.h"
#include <cassert>
#include <cstdint>
#include <deque>
#include <map>
#include <set>
#include <string>
#include <variant>
#include <vector>

#define DEBUG_TYPE

usingnamespacellvm;

//===----------------------------------------------------------------------===//
// DfaEmitter implementation. This is independent of the GenAutomaton backend.
//===----------------------------------------------------------------------===//

void DfaEmitter::addTransition(state_type From, state_type To, action_type A) {}

void DfaEmitter::visitDfaState(const DfaState &DS) {}

void DfaEmitter::constructDfa() {}

void DfaEmitter::emit(StringRef Name, raw_ostream &OS) {}

void DfaEmitter::printActionType(raw_ostream &OS) {}

void DfaEmitter::printActionValue(action_type A, raw_ostream &OS) {}

//===----------------------------------------------------------------------===//
// AutomatonEmitter implementation
//===----------------------------------------------------------------------===//

namespace {

Action;
ActionTuple;
class Automaton;

class Transition {};

class Automaton {};

class AutomatonEmitter {};

/// A DfaEmitter implementation that can print our variant action type.
class CustomDfaEmitter : public DfaEmitter {};
} // namespace

void AutomatonEmitter::run(raw_ostream &OS) {}

Automaton::Automaton(const RecordKeeper &Records, const Record *R)
    :{}

void Automaton::emit(raw_ostream &OS) {}

StringRef Automaton::getActionSymbolType(StringRef A) {}

Transition::Transition(const Record *R, Automaton *Parent) {}

bool Transition::canTransitionFrom(uint64_t State) {}

uint64_t Transition::transitionFrom(uint64_t State) {}

void CustomDfaEmitter::printActionType(raw_ostream &OS) {}

void CustomDfaEmitter::printActionValue(action_type A, raw_ostream &OS) {}

static TableGen::Emitter::OptClass<AutomatonEmitter>
    X("gen-automata", "Generate generic automata");