FLAME  devel
 All Classes Functions Variables Typedefs Enumerations Pages
examples/sim.cpp
#include <stdio.h>
#include <iostream>
#include "flame/config.h"
#include "flame/base.h"
int main(int argc, char *argv[])
{
try {
if(argc<2) return 2;
registerLinear();
std::auto_ptr<Config> conf;
{
GLPSParser parser;
conf.reset(parser.parse_file(argv[1]));
}
Machine mymachine(*conf);
mymachine.set_trace(&std::cout); // print intermediates
std::auto_ptr<StateBase> thestate(mymachine.allocState());
std::cout<<"Initial state "<<*thestate<<"\n";
mymachine.propagate(thestate.get());
std::cout<<"Final state "<<*thestate<<"\n";
return 0;
} catch(std::exception& e) {
std::cerr<<"Error: "<<e.what()<<"\n";
return 1;
}
}