mirror of
https://github.com/boostorg/spirit.git
synced 2026-02-22 15:42:32 +00:00
34 lines
1.1 KiB
C++
34 lines
1.1 KiB
C++
/*=============================================================================
|
|
Copyright (c) 2001-2011 Joel de Guzman
|
|
|
|
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
|
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
|
=============================================================================*/
|
|
#if !defined(BOOST_SPIRIT_CALC7_COMPILER_HPP)
|
|
#define BOOST_SPIRIT_CALC7_COMPILER_HPP
|
|
|
|
#include "ast.hpp"
|
|
#include <vector>
|
|
|
|
namespace client
|
|
{
|
|
///////////////////////////////////////////////////////////////////////////
|
|
// The Compiler
|
|
///////////////////////////////////////////////////////////////////////////
|
|
struct compiler
|
|
{
|
|
typedef void result_type;
|
|
|
|
std::vector<int>& code;
|
|
compiler(std::vector<int>& code)
|
|
: code(code) {}
|
|
|
|
void operator()(ast::nil) const { BOOST_ASSERT(0); }
|
|
void operator()(unsigned int n) const;
|
|
void operator()(ast::operation const& x) const;
|
|
void operator()(ast::signed_ const& x) const;
|
|
void operator()(ast::program const& x) const;
|
|
};
|
|
}
|
|
|
|
#endif |