-
-
Save parsa/6c2a601a6b402e24efba84aa3e9d0ce2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copyright (c) 2018 Shahrzad Shirzad | |
// | |
// 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) | |
#include <phylanx/phylanx.hpp> | |
#include <hpx/hpx_main.hpp> | |
#include <iostream> | |
/////////////////////////////////////////////////////////////////////////////// | |
char const* const tecode = R"(block( | |
define(fib_test, iterations, | |
block( | |
define(x, 1.0), | |
define(z, 0.0), | |
define(y, 1.0), | |
define(temp, 0.0), | |
define(step, 0), | |
while( | |
step < iterations, | |
block( | |
store(z, x + y), | |
store(temp, y), | |
store(y, z), | |
store(x, temp), | |
store(step, step + 1) | |
) | |
), | |
z | |
) | |
), | |
fib_test | |
))"; | |
int main() | |
{ | |
// Compile the given code | |
phylanx::execution_tree::compiler::function_list snippets; | |
auto fib_test = phylanx::execution_tree::compile(tecode, snippets); | |
auto const result = fib_test(static_cast<std::int64_t>(10)); | |
return hpx::finalize(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment