Index: cpp/CONTRIBUTORS.txt
===================================================================
--- cpp/CONTRIBUTORS.txt	(revision 1304)
+++ 	(revision )
@@ -1,16 +1,0 @@
-Framsticks SDK was first published by Szymon Ulatowski and Maciej Komosinski in 1999
-as a small part of Framsticks source code, mainly concerned with the processing of genotypes
-(loading, saving, converting between genetic formats, mutating, crossing over, checking, 
-validating, highlighting syntax, etc.).
-
-Since then, new pieces of source code are constantly added to facilitate the interaction
-with the Framsticks project, the usage of its pieces in related applications, and testing.
-In cooperation with the Framsticks authors, other developers were involved in improving
-the existing source code, implementing of ideas and contributing sources:
-
-	Adam Rotaru-Varga - initial versions of the f4 genetic encoding,
-	Marek Kubiak - initial versions of the similarity measure,
-	Agnieszka Mensfelt - the similarity measure and the SVD,
-	Grzegorz Latosinski - genetic encodings: f4 update, fH, fB, fL,
-	Jakub Sztyma - the fS genetic encoding.
-
Index: cpp/LICENSE.txt
===================================================================
--- cpp/LICENSE.txt	(revision 1304)
+++ 	(revision )
@@ -1,452 +1,0 @@
-If you use any part of Framsticks SDK in a project which is not
-a part of Framsticks software, please explicitly acknowledge Framsticks SDK
-and provide a link to www.framsticks.com
-
----
-
-
-		  GNU LIBRARY GENERAL PUBLIC LICENSE
-		       Version 2, June 1991
-
- Copyright (C) 1991 Free Software Foundation, Inc.
-    		    59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-[This is the first released version of the library GPL.  It is
- numbered 2 because it goes with version 2 of the ordinary GPL.]
-
-			    Preamble
-
-  The licenses for most software are designed to take away your
-freedom to share and change it.  By contrast, the GNU General Public
-Licenses are intended to guarantee your freedom to share and change
-free software--to make sure the software is free for all its users.
-
-  This license, the Library General Public License, applies to some
-specially designated Free Software Foundation software, and to any
-other libraries whose authors decide to use it.  You can use it for
-your libraries, too.
-
-  When we speak of free software, we are referring to freedom, not
-price.  Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
-
-  To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if
-you distribute copies of the library, or if you modify it.
-
-  For example, if you distribute copies of the library, whether gratis
-or for a fee, you must give the recipients all the rights that we gave
-you.  You must make sure that they, too, receive or can get the source
-code.  If you link a program with the library, you must provide
-complete object files to the recipients so that they can relink them
-with the library, after making changes to the library and recompiling
-it.  And you must show them these terms so they know their rights.
-
-  Our method of protecting your rights has two steps: (1) copyright
-the library, and (2) offer you this license which gives you legal
-permission to copy, distribute and/or modify the library.
-
-  Also, for each distributor's protection, we want to make certain
-that everyone understands that there is no warranty for this free
-library.  If the library is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original
-version, so that any problems introduced by others will not reflect on
-the original authors' reputations.
-
-
-  Finally, any free program is threatened constantly by software
-patents.  We wish to avoid the danger that companies distributing free
-software will individually obtain patent licenses, thus in effect
-transforming the program into proprietary software.  To prevent this,
-we have made it clear that any patent must be licensed for everyone's
-free use or not licensed at all.
-
-  Most GNU software, including some libraries, is covered by the ordinary
-GNU General Public License, which was designed for utility programs.  This
-license, the GNU Library General Public License, applies to certain
-designated libraries.  This license is quite different from the ordinary
-one; be sure to read it in full, and don't assume that anything in it is
-the same as in the ordinary license.
-
-  The reason we have a separate public license for some libraries is that
-they blur the distinction we usually make between modifying or adding to a
-program and simply using it.  Linking a program with a library, without
-changing the library, is in some sense simply using the library, and is
-analogous to running a utility program or application program.  However, in
-a textual and legal sense, the linked executable is a combined work, a
-derivative of the original library, and the ordinary General Public License
-treats it as such.
-
-  Because of this blurred distinction, using the ordinary General
-Public License for libraries did not effectively promote software
-sharing, because most developers did not use the libraries.  We
-concluded that weaker conditions might promote sharing better.
-
-  However, unrestricted linking of non-free programs would deprive the
-users of those programs of all benefit from the free status of the
-libraries themselves.  This Library General Public License is intended to
-permit developers of non-free programs to use free libraries, while
-preserving your freedom as a user of such programs to change the free
-libraries that are incorporated in them.  (We have not seen how to achieve
-this as regards changes in header files, but we have achieved it as regards
-changes in the actual functions of the Library.)  The hope is that this
-will lead to faster development of free libraries.
-
-  The precise terms and conditions for copying, distribution and
-modification follow.  Pay close attention to the difference between a
-"work based on the library" and a "work that uses the library".  The
-former contains code derived from the library, while the latter only
-works together with the library.
-
-  Note that it is possible for a library to be covered by the ordinary
-General Public License rather than by this special one.
-
-
-		  GNU LIBRARY GENERAL PUBLIC LICENSE
-   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
-  0. This License Agreement applies to any software library which
-contains a notice placed by the copyright holder or other authorized
-party saying it may be distributed under the terms of this Library
-General Public License (also called "this License").  Each licensee is
-addressed as "you".
-
-  A "library" means a collection of software functions and/or data
-prepared so as to be conveniently linked with application programs
-(which use some of those functions and data) to form executables.
-
-  The "Library", below, refers to any such software library or work
-which has been distributed under these terms.  A "work based on the
-Library" means either the Library or any derivative work under
-copyright law: that is to say, a work containing the Library or a
-portion of it, either verbatim or with modifications and/or translated
-straightforwardly into another language.  (Hereinafter, translation is
-included without limitation in the term "modification".)
-
-  "Source code" for a work means the preferred form of the work for
-making modifications to it.  For a library, complete source code means
-all the source code for all modules it contains, plus any associated
-interface definition files, plus the scripts used to control compilation
-and installation of the library.
-
-  Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope.  The act of
-running a program using the Library is not restricted, and output from
-such a program is covered only if its contents constitute a work based
-on the Library (independent of the use of the Library in a tool for
-writing it).  Whether that is true depends on what the Library does
-and what the program that uses the Library does.
-  
-  1. You may copy and distribute verbatim copies of the Library's
-complete source code as you receive it, in any medium, provided that
-you conspicuously and appropriately publish on each copy an
-appropriate copyright notice and disclaimer of warranty; keep intact
-all the notices that refer to this License and to the absence of any
-warranty; and distribute a copy of this License along with the
-Library.
-
-  You may charge a fee for the physical act of transferring a copy,
-and you may at your option offer warranty protection in exchange for a
-fee.
-
-
-  2. You may modify your copy or copies of the Library or any portion
-of it, thus forming a work based on the Library, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
-    a) The modified work must itself be a software library.
-
-    b) You must cause the files modified to carry prominent notices
-    stating that you changed the files and the date of any change.
-
-    c) You must cause the whole of the work to be licensed at no
-    charge to all third parties under the terms of this License.
-
-    d) If a facility in the modified Library refers to a function or a
-    table of data to be supplied by an application program that uses
-    the facility, other than as an argument passed when the facility
-    is invoked, then you must make a good faith effort to ensure that,
-    in the event an application does not supply such function or
-    table, the facility still operates, and performs whatever part of
-    its purpose remains meaningful.
-
-    (For example, a function in a library to compute square roots has
-    a purpose that is entirely well-defined independent of the
-    application.  Therefore, Subsection 2d requires that any
-    application-supplied function or table used by this function must
-    be optional: if the application does not supply it, the square
-    root function must still compute square roots.)
-
-These requirements apply to the modified work as a whole.  If
-identifiable sections of that work are not derived from the Library,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works.  But when you
-distribute the same sections as part of a whole which is a work based
-on the Library, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote
-it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Library.
-
-In addition, mere aggregation of another work not based on the Library
-with the Library (or with a work based on the Library) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
-  3. You may opt to apply the terms of the ordinary GNU General Public
-License instead of this License to a given copy of the Library.  To do
-this, you must alter all the notices that refer to this License, so
-that they refer to the ordinary GNU General Public License, version 2,
-instead of to this License.  (If a newer version than version 2 of the
-ordinary GNU General Public License has appeared, then you can specify
-that version instead if you wish.)  Do not make any other change in
-these notices.
-
-
-  Once this change is made in a given copy, it is irreversible for
-that copy, so the ordinary GNU General Public License applies to all
-subsequent copies and derivative works made from that copy.
-
-  This option is useful when you wish to copy part of the code of
-the Library into a program that is not a library.
-
-  4. You may copy and distribute the Library (or a portion or
-derivative of it, under Section 2) in object code or executable form
-under the terms of Sections 1 and 2 above provided that you accompany
-it with the complete corresponding machine-readable source code, which
-must be distributed under the terms of Sections 1 and 2 above on a
-medium customarily used for software interchange.
-
-  If distribution of object code is made by offering access to copy
-from a designated place, then offering equivalent access to copy the
-source code from the same place satisfies the requirement to
-distribute the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
-  5. A program that contains no derivative of any portion of the
-Library, but is designed to work with the Library by being compiled or
-linked with it, is called a "work that uses the Library".  Such a
-work, in isolation, is not a derivative work of the Library, and
-therefore falls outside the scope of this License.
-
-  However, linking a "work that uses the Library" with the Library
-creates an executable that is a derivative of the Library (because it
-contains portions of the Library), rather than a "work that uses the
-library".  The executable is therefore covered by this License.
-Section 6 states terms for distribution of such executables.
-
-  When a "work that uses the Library" uses material from a header file
-that is part of the Library, the object code for the work may be a
-derivative work of the Library even though the source code is not.
-Whether this is true is especially significant if the work can be
-linked without the Library, or if the work is itself a library.  The
-threshold for this to be true is not precisely defined by law.
-
-  If such an object file uses only numerical parameters, data
-structure layouts and accessors, and small macros and small inline
-functions (ten lines or less in length), then the use of the object
-file is unrestricted, regardless of whether it is legally a derivative
-work.  (Executables containing this object code plus portions of the
-Library will still fall under Section 6.)
-
-  Otherwise, if the work is a derivative of the Library, you may
-distribute the object code for the work under the terms of Section 6.
-Any executables containing that work also fall under Section 6,
-whether or not they are linked directly with the Library itself.
-
-
-  6. As an exception to the Sections above, you may also compile or
-link a "work that uses the Library" with the Library to produce a
-work containing portions of the Library, and distribute that work
-under terms of your choice, provided that the terms permit
-modification of the work for the customer's own use and reverse
-engineering for debugging such modifications.
-
-  You must give prominent notice with each copy of the work that the
-Library is used in it and that the Library and its use are covered by
-this License.  You must supply a copy of this License.  If the work
-during execution displays copyright notices, you must include the
-copyright notice for the Library among them, as well as a reference
-directing the user to the copy of this License.  Also, you must do one
-of these things:
-
-    a) Accompany the work with the complete corresponding
-    machine-readable source code for the Library including whatever
-    changes were used in the work (which must be distributed under
-    Sections 1 and 2 above); and, if the work is an executable linked
-    with the Library, with the complete machine-readable "work that
-    uses the Library", as object code and/or source code, so that the
-    user can modify the Library and then relink to produce a modified
-    executable containing the modified Library.  (It is understood
-    that the user who changes the contents of definitions files in the
-    Library will not necessarily be able to recompile the application
-    to use the modified definitions.)
-
-    b) Accompany the work with a written offer, valid for at
-    least three years, to give the same user the materials
-    specified in Subsection 6a, above, for a charge no more
-    than the cost of performing this distribution.
-
-    c) If distribution of the work is made by offering access to copy
-    from a designated place, offer equivalent access to copy the above
-    specified materials from the same place.
-
-    d) Verify that the user has already received a copy of these
-    materials or that you have already sent this user a copy.
-
-  For an executable, the required form of the "work that uses the
-Library" must include any data and utility programs needed for
-reproducing the executable from it.  However, as a special exception,
-the source code distributed need not include anything that is normally
-distributed (in either source or binary form) with the major
-components (compiler, kernel, and so on) of the operating system on
-which the executable runs, unless that component itself accompanies
-the executable.
-
-  It may happen that this requirement contradicts the license
-restrictions of other proprietary libraries that do not normally
-accompany the operating system.  Such a contradiction means you cannot
-use both them and the Library together in an executable that you
-distribute.
-
-
-  7. You may place library facilities that are a work based on the
-Library side-by-side in a single library together with other library
-facilities not covered by this License, and distribute such a combined
-library, provided that the separate distribution of the work based on
-the Library and of the other library facilities is otherwise
-permitted, and provided that you do these two things:
-
-    a) Accompany the combined library with a copy of the same work
-    based on the Library, uncombined with any other library
-    facilities.  This must be distributed under the terms of the
-    Sections above.
-
-    b) Give prominent notice with the combined library of the fact
-    that part of it is a work based on the Library, and explaining
-    where to find the accompanying uncombined form of the same work.
-
-  8. You may not copy, modify, sublicense, link with, or distribute
-the Library except as expressly provided under this License.  Any
-attempt otherwise to copy, modify, sublicense, link with, or
-distribute the Library is void, and will automatically terminate your
-rights under this License.  However, parties who have received copies,
-or rights, from you under this License will not have their licenses
-terminated so long as such parties remain in full compliance.
-
-  9. You are not required to accept this License, since you have not
-signed it.  However, nothing else grants you permission to modify or
-distribute the Library or its derivative works.  These actions are
-prohibited by law if you do not accept this License.  Therefore, by
-modifying or distributing the Library (or any work based on the
-Library), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Library or works based on it.
-
-  10. Each time you redistribute the Library (or any work based on the
-Library), the recipient automatically receives a license from the
-original licensor to copy, distribute, link with or modify the Library
-subject to these terms and conditions.  You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
-this License.
-
-
-  11. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License.  If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Library at all.  For example, if a patent
-license would not permit royalty-free redistribution of the Library by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Library.
-
-If any portion of this section is held invalid or unenforceable under any
-particular circumstance, the balance of the section is intended to apply,
-and the section as a whole is intended to apply in other circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system which is
-implemented by public license practices.  Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
-  12. If the distribution and/or use of the Library is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Library under this License may add
-an explicit geographical distribution limitation excluding those countries,
-so that distribution is permitted only in or among countries not thus
-excluded.  In such case, this License incorporates the limitation as if
-written in the body of this License.
-
-  13. The Free Software Foundation may publish revised and/or new
-versions of the Library General Public License from time to time.
-Such new versions will be similar in spirit to the present version,
-but may differ in detail to address new problems or concerns.
-
-Each version is given a distinguishing version number.  If the Library
-specifies a version number of this License which applies to it and
-"any later version", you have the option of following the terms and
-conditions either of that version or of any later version published by
-the Free Software Foundation.  If the Library does not specify a
-license version number, you may choose any version ever published by
-the Free Software Foundation.
-
-
-  14. If you wish to incorporate parts of the Library into other free
-programs whose distribution conditions are incompatible with these,
-write to the author to ask for permission.  For software which is
-copyrighted by the Free Software Foundation, write to the Free
-Software Foundation; we sometimes make exceptions for this.  Our
-decision will be guided by the two goals of preserving the free status
-of all derivatives of our free software and of promoting the sharing
-and reuse of software generally.
-
-			    NO WARRANTY
-
-  15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
-WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
-EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
-OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
-KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
-LIBRARY IS WITH YOU.  SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
-THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
-  16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
-WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
-AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
-FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
-CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
-LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
-RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
-FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
-SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
-DAMAGES.
-
-		     END OF TERMS AND CONDITIONS
Index: cpp/README.txt
===================================================================
--- cpp/README.txt	(revision 1304)
+++ 	(revision )
@@ -1,50 +1,0 @@
-_______________ Building SDK demos and test applications ________________
-
-make -f frams/Makefile-SDK sdk_tests
-
-
-Even if you don't use 'make', you can create a project for your favorite
-development environment. The sources should compile under *nixes, osx,
-windows (visual C++, borland/embarcadero), cygwin, android, ios, and tizen.
-
-
-___________________________ Source directories __________________________
-
-   +- common           - general compatibility layer, utilities
-   +- frams            - Framsticks modules
-      +- _demos        - SDK tests and sample applications
-      +- canvas        - neural network layouts and drawing
-      +- config        - SDK elements declarations
-      +- genetics      - genetic operators and converters between genetic formats
-         +- f1         - ...for genetic format f1 (recurrent encoding)
-         +- f4         - ...for genetic format f4 (developmental encoding)
-         +- f9         - ...for genetic format f9 (3D turtle encoding)
-         +- fB         - ...for genetic format fB ("biological" encoding)
-         +- fF         - ...for genetic format fF (Foraminifera encoding)
-         +- fH         - ...for genetic format fH (multidimensional handles)
-         +- fL         - ...for genetic format fL (Lindenmayer systems)
-         +- fS         - ...for genetic format fS (similar to f1, but for solid shapes)
-         +- fn         - ...for genetic format fn (numerical optimization encoding)
-         +- fT         - ...for genetic format fT (educational: ATGC sequences)
-      +- loggers       - printing and redirecting logMessage() and logPrint() messages
-      +- model         - body: parts, joints; brain: neurons, connections
-         +- geometry   - compute dimensions, volume, surface area
-         +- similarity - determine structural and geometric similarity
-      +- neuro         - neural network simulation
-         +- impl       - neuron classes implementations
-      +- param         - C++/properties access objects
-      +- util          - Framsticks-related utilities
-      +- virtfile      - object-oriented FILE* replacement
-      +- vm            - virtual machine programming: FramScript grammar (lex and yacc/bison)
-          +- classes   - C++ interfaces and implementations of basic FramScript objects
-
-
-______________________ Source formatting guidelines _____________________
-
-File names: all letters are lower case, with '-' as word separator if needed.
-Indents: tab
-Scopes
-{
-	ClassName variable_lower_case;
-	variable_lower_case.camelCaseMathodOrFunction();
-}
Index: cpp/f8-to-f1/conv_f8_utils.cpp
===================================================================
--- cpp/f8-to-f1/conv_f8_utils.cpp	(revision 1)
+++ cpp/f8-to-f1/conv_f8_utils.cpp	(revision 1)
@@ -0,0 +1,168 @@
+/*
+ *  conv_f8_utils.cpp
+ *  L-systemToF1
+ *
+ *  Created by Maciej Wajcht on 08-09-21.
+ *  Copyright 2008 __MyCompanyName__. All rights reserved.
+ *
+ */
+
+#include "conv_f8_utils.h"
+
+using namespace std;
+
+bool containsChars(const SString s, char c[]) {
+const char* str=(const char*)s;
+	for (int i = 0; i < s.len(); i++) {
+		for (int j = 0; j < strlen(c); j++) {
+			if (str[i] == c[j]) {
+				return true;
+			}
+		}
+	}
+	return false;
+}
+
+bool containsChar(std::vector<char> tab, char c) {
+	for (int i = 0; i < tab.size(); i++) {
+		if (tab[i] == c) {
+			return true;
+		}
+	}
+	return false;
+}
+
+int reverseFindInSString(const SString s, char c, int index) {
+	if (index > 0) {
+		index = (s.len() - 1 > index) ? index : s.len() - 1; //min(index, s.len() - 1)
+	} else {
+		index = s.len() - 1;
+	}
+	
+const char* str=(const char*)s;
+	for (int i = index; i >= 0; i--) {
+		if (str[i] == c) {
+			return i;
+		}
+	}
+	return -1;
+}
+
+SString trimSString(const SString s) {
+	SString result = "";
+	for (int i = 0; i < s.len(); i++) {
+		char c = s.charAt(i);
+		if (c != ' ' && c != '\t') {
+			result += c;
+		}
+	}
+	return result;
+}
+
+double parseDouble(const SString &s) {
+	const char* str = s;
+	std::istringstream i(str);
+	double x;
+	if (!(i >> x))
+		throw BadConversion("parseDouble(\"" + string(str) + "\")");
+	return x;
+}
+
+int parseInt(const SString &s) {
+	const char* str = s;
+	std::istringstream i(str);
+	int x;
+	if (!(i >> x))
+		throw BadConversion("parseInt(\"" + string(str) + "\")");
+	return x;
+}
+
+SString stringToSString(string str) {
+	return SString(str.c_str());
+}
+
+string sstringToString(SString sstr) {
+	const char* tmp = sstr;
+	return string(tmp);
+}
+
+SString convertReversePolishNotationToNatural(const SString &s) {
+	SString result = "";
+	SString tok = "";
+	int pos = 0;
+	stack<SString> stck;
+	
+	while (s.getNextToken(pos, tok, ';')) {
+		if (tok.len() == 1  && (tok[0] == '+' || tok[0] == '-' || tok[0] == '*' || tok[0] == '/')) {
+			SString s1, s2;
+			if (!stck.empty()) {
+				s1 = stck.top();
+				stck.pop();
+			} else {
+				throw ParseExpressionException("Not enough elements on stack: " + sstringToString(s));
+			}
+			if (!stck.empty()) {
+				s2 = stck.top();
+				stck.pop();
+			} else {
+				throw ParseExpressionException("Not enough elements on stack: " + sstringToString(s));
+			}
+			switch (tok[0]) {
+				case '+': stck.push(s2 + "+" + s1); break;
+				case '-': stck.push(s2 + "-" + s1); break;
+				case '*': stck.push(s2 + "*" + s1); break;
+				case '/': stck.push(s2 + "/" + s1); break;
+			}
+		} else if (tok.len() > 0) {
+			stck.push(tok);
+		}
+	}
+	
+	result = stck.top();	
+	
+	return result;
+}
+
+double parseExpression(const SString &s) {
+	double result = 0;
+	SString tok = "";
+	int pos = 0;
+	stack<double> stck;
+	
+	while (s.getNextToken(pos, tok, ';')) {
+		if (tok.len() == 1  && (tok[0] == '+' || tok[0] == '-' || tok[0] == '*' || tok[0] == '/')) {
+			double n1, n2;
+			if (!stck.empty()) {
+				n1 = stck.top();
+				stck.pop();
+			} else {
+				throw ParseExpressionException("Not enough elements on stack: " + sstringToString(s));
+			}
+			if (!stck.empty()) {
+				n2 = stck.top();
+				stck.pop();
+			} else {
+				throw ParseExpressionException("Not enough elements on stack: " + sstringToString(s));
+			}
+			switch (tok[0]) {
+				case '+': stck.push(n2 + n1); break;
+				case '-': stck.push(n2 - n1); break;
+				case '*': stck.push(n2 * n1); break;
+				case '/': 
+					if (n1 == 0) {
+						throw ParseExpressionException("Division by zero");
+					}
+					stck.push(n2 / n1); 
+					break;
+			}
+		} else if (tok.len() > 0) {
+			stck.push(parseDouble(tok));
+		}/* else {
+		 throw ParseExpressionException("Unrecognized element in input string '" + sstringToString(tmp) + "'");
+		 }*/
+	}
+	
+	result = stck.top();
+	
+	return result;
+}
Index: cpp/f8-to-f1/conv_f8_utils.h
===================================================================
--- cpp/f8-to-f1/conv_f8_utils.h	(revision 1)
+++ cpp/f8-to-f1/conv_f8_utils.h	(revision 1)
@@ -0,0 +1,45 @@
+/*
+ *  conv_f8_utils.h
+ *  L-systemToF1
+ *
+ *  Created by Maciej Wajcht on 08-09-21.
+ *  Copyright 2008 __MyCompanyName__. All rights reserved.
+ *
+ */
+
+#ifndef _CONV_F8_UTILS_H_
+#define _CONV_F8_UTILS_H_
+
+#include <iostream>
+#include <sstream>
+#include <string>
+#include <stdexcept>
+#include <stack>
+#include <vector>
+#include "sstring.h"
+
+using namespace std;
+
+class BadConversion : public std::runtime_error {
+public:
+	BadConversion(const std::string &s) : std::runtime_error(s)	{ }
+};
+
+class ParseExpressionException : public std::runtime_error {
+public:
+	ParseExpressionException(const std::string &s) : std::runtime_error(s) { }
+};
+
+bool containsChars(const SString s, char c[]);
+bool containsChar(std::vector<char> tab, char c);
+int reverseFindInSString(const SString s, char c, int index = -1);
+SString trimSString(const SString s);
+SString trimSString(const SString s);
+double parseDouble(const SString &s);
+int parseInt(const SString &s);
+SString stringToSString(string str);
+string sstringToString(SString sstr);
+SString convertReversePolishNotationToNatural(const SString &s);
+double parseExpression(const SString &s);
+
+#endif
Index: cpp/f8-to-f1/conv_f8tof1.cpp
===================================================================
--- cpp/f8-to-f1/conv_f8tof1.cpp	(revision 1)
+++ cpp/f8-to-f1/conv_f8tof1.cpp	(revision 1)
@@ -0,0 +1,730 @@
+/*
+ *  conv_f8tof1.cpp
+ *  L-systemToF1
+ *
+ *  Created by Maciej Wajcht on 08-03-21.
+ *  Copyright 2008 __MyCompanyName__. All rights reserved.
+ *
+ */
+
+#include "conv_f8tof1.h"
+#include "conv_f8_utils.h"
+#include <sstream>
+#include <string>
+#include <algorithm>
+#include "lexglobal.h"
+#include "conv_f8tof1_scanner.h"
+namespace prs {
+	#include "conv_f8tof1_grammar.c"
+}
+
+#if CONV_DEBUG > 0
+	#include <iostream>
+#endif
+
+#define CONV_DEBUG 0 //0 - off, 1 - minimal, 2 - full
+
+using namespace std;
+
+Lsystem::Lsystem() {
+	PrimitiveProduction *pp1 = new PrimitiveProduction(SString("X"));
+	this->primitiveProductions.insert(make_pair("X", pp1));
+	PrimitiveProduction *pp2 = new PrimitiveProduction(SString("R"));
+	this->primitiveProductions.insert(make_pair("R", pp2));
+	PrimitiveProduction *pp3 = new PrimitiveProduction(SString("r"));
+	this->primitiveProductions.insert(make_pair("r", pp3));
+	PrimitiveProduction *pp4 = new PrimitiveProduction(SString("C"));
+	this->primitiveProductions.insert(make_pair("C", pp4));
+	PrimitiveProduction *pp5 = new PrimitiveProduction(SString("c"));
+	this->primitiveProductions.insert(make_pair("c", pp5));
+	PrimitiveProduction *pp6 = new PrimitiveProduction(SString("Q"));
+	this->primitiveProductions.insert(make_pair("Q", pp6));
+	PrimitiveProduction *pp7 = new PrimitiveProduction(SString("q"));
+	this->primitiveProductions.insert(make_pair("q", pp7));
+	PrimitiveProduction *pp8 = new PrimitiveProduction(SString("["));
+	this->primitiveProductions.insert(make_pair("[", pp8));
+	PrimitiveProduction *pp9 = new PrimitiveProduction(SString("]"));
+	this->primitiveProductions.insert(make_pair("]", pp9));
+	PrimitiveProduction *pp10 = new PrimitiveProduction(SString("^"));
+	this->primitiveProductions.insert(make_pair("^", pp10));
+	
+}
+		 
+Lsystem::~Lsystem() {
+	for (map<string, Production*>::iterator iter = this->productions.begin(); 
+		 iter != this->productions.end(); iter++) {
+		delete iter->second;
+	}
+	for (map<string, PrimitiveProduction*>::iterator iter = this->primitiveProductions.begin(); 
+		 iter != this->primitiveProductions.end(); iter++) {
+		delete iter->second;
+	}
+	for (map<string, ParamProduction*>::iterator iter = this->paramProductions.begin(); 
+		 iter != this->paramProductions.end(); iter++) {
+		delete iter->second;
+	}
+	for (vector<NeuronProduction*>::iterator iter = this->neuronProductions.begin();
+		 iter != this->neuronProductions.end(); iter++) {
+		delete *iter;
+	}
+}
+
+PrimitiveProduction* Lsystem::getPrimitiveProduction(SString name) {
+	string sname = sstringToString(name);
+	if (this->primitiveProductions.find(sname) == this->primitiveProductions.end()) {
+		PrimitiveProduction *pp = new PrimitiveProduction(name);
+		this->primitiveProductions.insert(make_pair(sname, pp));
+	}
+	return this->primitiveProductions[sname];
+}
+
+ParamProduction* Lsystem::getParamProduction(SString name) {
+	string sname = sstringToString(name);
+	if (this->paramProductions.find(sname) == this->paramProductions.end()) {
+		ParamProduction *pp = new ParamProduction(name);
+		this->paramProductions.insert(make_pair(sname, pp));
+	}
+	return this->paramProductions[sname];
+}
+
+SString Lsystem::toString() {
+	this->removeEmptySubproductionsAndProductions();
+	SString result = "";
+	result += SString::valueOf(this->iterations) + "\n";
+	for (map<string, double>::iterator it = this->startParams.begin(); 
+		 it != this->startParams.end(); it++) {
+		result += stringToSString(it->first) + "=" + SString::valueOf(it->second) + "\n";
+	}
+	result += SString("---") + "\n";
+	result += stringToSString(this->firstProductionName) + "\n";
+	for (map<string, Production*>::iterator prodIter = this->productions.begin();
+		 prodIter != this->productions.end(); prodIter++) {
+		Production *p = prodIter->second;
+		result += p->name + "(";
+		for (int i = 1; i <= p->parameters.size(); i++) {
+			result += p->parameters.getParameterName(i);
+			if (i < p->parameters.size()) {
+				result += ",";
+			}
+		}
+		result += "):";
+		for (int subprodIter = 0; subprodIter < p->subproductions.size(); subprodIter++) {
+			SubProduction *sp = &(p->subproductions[subprodIter]);
+			for (int condIter = 0; condIter < sp->conditions.size(); condIter++) {
+				Condition *c = &(sp->conditions[condIter]);
+				RelationType r = c->relation;
+				SString op = (r == r_greater) ? ">" : (r == r_greaterEqual) ? ">=" : (r == r_less) ? "<" :
+				(r == r_lessEqual) ? "<=" : (r == r_equal) ? "==" : (r == r_different) ? "!=" : "";
+				result += c->parameter + op + SString::valueOf(c->value);
+				if (condIter != sp->conditions.size() - 1) {
+					result += ",";
+				}
+			}
+			if (sp->conditions.size() > 0) {
+				result += SString("|");
+			}
+			for (vector<ActionStrP>::iterator actionIter = sp->actions.begin();
+				 actionIter != sp->actions.end(); actionIter++) {
+				ActionStrP *a = &(*actionIter);
+				if (a->action == NULL) {
+					continue;
+				}
+				result += a->action->getF8Representation();
+				if (!a->action->ignoreParams) {
+					result += SString("(");
+					for (int paramIter = 0; paramIter < a->params.size(); paramIter++) {
+						result += convertReversePolishNotationToNatural(a->params[paramIter]);
+						if (paramIter != a->params.size() - 1) {
+							result += ",";
+						}
+					}
+					result += SString(")");					
+				}
+			}
+			if (subprodIter != p->subproductions.size() - 1) {
+				result += SString(":");
+			}
+		}
+		result += SString("\n");
+	}	
+	return result;
+}
+
+vector<Action*> Lsystem::getAllActions(bool normal, bool primitives, bool params, bool neurons) {
+	vector<Action*> actions;
+	if (normal) {
+		for (map<string, Production*>::iterator iter = this->productions.begin(); 
+			 iter != this->productions.end(); iter++) {
+			actions.push_back(iter->second);
+		}
+	}
+	if (primitives) {
+		for (map<string, PrimitiveProduction*>::iterator iter = this->primitiveProductions.begin(); 
+			 iter != this->primitiveProductions.end(); iter++) {
+			actions.push_back(iter->second);
+		}
+	}
+	if (params) {
+		for (map<string, ParamProduction*>::iterator iter = this->paramProductions.begin(); 
+			 iter != this->paramProductions.end(); iter++) {
+			actions.push_back(iter->second);
+		}
+	}
+	if (neurons) {
+		for (vector<NeuronProduction*>::iterator iter = this->neuronProductions.begin(); 
+			 iter != this->neuronProductions.end(); iter++) {
+			actions.push_back(*iter);
+		}
+	}
+	return actions;
+}
+
+void Lsystem::removeEmptySubproductionsAndProductions() {
+	/* po wykonaniu moga pozostac puste subprodukcje (usuwanie wywolan do usunietych wczesniej produkcji
+	 * ale i tak znikna one przy kolejnym wywolaniu, tak wiec ilosc smieci nie powinna byc razaca
+	 */
+	
+	//delete empty subproductions
+	for (map<string, Production*>::iterator prodIter = this->productions.begin();
+		 prodIter != this->productions.end(); prodIter++) {
+		vector<SubProduction> *subproductions = &(prodIter->second->subproductions);
+		for (int i = 0; i < subproductions->size(); i++) {
+			if (subproductions->at(i).actions.size() == 0) {
+				subproductions->erase(subproductions->begin() + i);
+			}
+		}
+	}
+	
+	//find empty productions
+	vector<SString> emptyProductionNames;	
+	for (map<string, Production*>::iterator prodIter = this->productions.begin();
+		 prodIter != this->productions.end(); prodIter++) {
+		if (prodIter->second->subproductions.size() == 0 && 
+			sstringToString(prodIter->second->name) != this->firstProductionName) {
+			emptyProductionNames.push_back(prodIter->second->name);
+		}
+	}
+	
+	//delete calls to empty productions
+	for (map<string, Production*>::iterator prodIter = this->productions.begin();
+		 prodIter != this->productions.end(); prodIter++) {
+		vector<SubProduction> *subproductions = &(prodIter->second->subproductions);
+		for (vector<SubProduction>::iterator subProdIter = subproductions->begin();
+			 subProdIter != subproductions->end(); subProdIter++) {
+			SubProduction *sp = &(*subProdIter);
+			for (int actionIter = 0; actionIter < sp->actions.size(); actionIter++) {
+				ActionStrP *actionstrp = &(sp->actions.at(actionIter));
+				if (actionstrp->action != NULL) {
+					vector<SString>::iterator result = find(emptyProductionNames.begin(), emptyProductionNames.end(), 
+															actionstrp->action->name);
+					if (result != emptyProductionNames.end()) { //emptyProductionNames contains the action name
+						sp->actions.erase(sp->actions.begin() + actionIter);
+					}
+				}
+			}
+		}
+	}
+	
+	//delete empty productions
+	for(int i = 0; i < emptyProductionNames.size(); i++) {
+		this->productions.erase(sstringToString(emptyProductionNames[i]));
+	}
+}
+
+ostream& operator<<(ostream& os, const Condition& c) {
+	RelationType r = c.relation;
+	SString op = (r == r_greater) ? ">" : (r == r_greaterEqual) ? ">=" : (r == r_less) ? "<" :
+	(r == r_lessEqual) ? "<=" : (r == r_equal) ? "==" : (r == r_different) ? "!=" : "";
+	os <<  c.parameter << " " << op << " " << c.value;
+	return os;
+}
+
+const double ParameterCollection::getValue(int position) {
+	string name = this->parameters[position - 1];
+	return this->paramValues[name];
+}
+
+const double ParameterCollection::getValue(SString name) {
+	return this->paramValues[sstringToString(name)];
+}
+
+const SString ParameterCollection::getParameterName(int position) {
+	return stringToSString(this->parameters[position - 1]);
+}
+
+const int ParameterCollection::getParameterPosition(SString name) {
+	for (int i = 0; i < this->parameters.size(); i++) {
+		string &s = this->parameters[i];
+		if (s == sstringToString(name)) {
+			return i + 1;
+		}
+	}
+	return -1;
+}
+
+void ParameterCollection::setValue(int position, double value) {
+	string name = this->parameters[position - 1];
+	this->paramValues[name] = value;
+}
+
+void ParameterCollection::setValue(SString name, double value) {
+	this->paramValues[sstringToString(name)] = value;
+}
+
+void ParameterCollection::addParameter(SString name, int position, double value) {
+	//TODO sprawdzenie czy position > 0
+	string sname = sstringToString(name);
+	if (position == -1) {
+		this->parameters.push_back(sname); 
+		this->paramValues[sname] = value;
+	} else {
+		this->parameters.reserve(position);
+		this->parameters.insert(this->parameters.begin() + (position -1), sname);
+		this->paramValues[sname] = value;
+	}
+	//this->paramValues[name] = value;
+}
+
+const int ParameterCollection::size() {
+	return this->parameters.size();
+}
+
+void ParameterCollection::removeParameter(int position) {
+	string name = this->parameters[position - 1];
+	vector<string>::iterator it = this->parameters.begin() + (position - 1);
+	this->parameters.erase(it);
+	this->paramValues.erase(name);
+}
+
+void ParameterCollection::removeParameter(SString name) {
+	int idx = getParameterPosition(name);
+	this->removeParameter(idx);
+}
+
+bool ParameterCollection::paramExist(SString name) {
+	string sname = sstringToString(name);
+	for (vector<string>::iterator it = this->parameters.begin(); it != this->parameters.end(); it++) {
+		if ((*it) == sname) {
+			return true;
+		}
+	}
+	return false;
+}
+
+PrimitiveProduction::PrimitiveProduction(const SString command) {
+	this->f8command = command;
+	this->ignoreParams = true;
+	if (command == SString("[")) {
+		this->f1command = SString("(");
+		this->name = SString("_primitive production '[' => '('");
+	} else if (command == SString("]")) {
+		this->f1command = SString(")");
+		this->name = SString("_primitive production ']' => ')'");
+	} else if (command == SString("^")) {
+		this->f1command = SString(",");
+		this->name = SString("_primitive production '^' => ','");
+	} else {
+		this->f1command = command;
+		this->name = SString("_primitive production '") + command + "'";
+	}
+}
+
+const SString PrimitiveProduction::getF1Genotype(const vector<double> params) {
+#if CONV_DEBUG > 1
+	cout << "@@@@@ Prymityw: " << this->f1command << endl;
+#endif
+	return SString(this->f1command);
+}
+
+const list<ActionP> PrimitiveProduction::getActionList(const vector<double> param) {
+	list<ActionP> l;
+	ActionP ap;
+	ap.action = this;
+	ap.params = param;
+	l.push_back(ap);
+	return l;
+}
+
+const SString PrimitiveProduction::getF8Representation() {
+	return this->f8command;
+}
+
+ParamProduction::ParamProduction(const SString paramName) {
+	this->paramName = paramName;
+	this->name = SString("_param production") + paramName;
+	this->ignoreParams = true;
+}
+
+const SString ParamProduction::getF1Genotype(const vector<double> params) {
+	SString s = SString::valueOf(params[0]);
+#if CONV_DEBUG > 1
+	cout << "@@@@@ Wartosc parametru: " << this->paramName << ": " << params[0] << endl;
+#endif
+	return s;
+	
+}
+
+const list<ActionP> ParamProduction::getActionList(const vector<double> param) {
+	list<ActionP> l;
+	ActionP ap;
+	ap.action = this;
+	ap.params = param;
+	l.push_back(ap);
+	return l;
+	
+}
+
+const SString ParamProduction::getF8Representation() {
+	return this->paramName;
+}
+
+NeuronProduction::NeuronProduction(const SString body) {
+	this->body = body;
+	this->name = SString("_neuron production") + body;
+	this->ignoreParams = true;
+}
+
+const SString NeuronProduction::getF1Genotype(const vector<double> params) {
+	return this->body;	
+}
+
+const list<ActionP> NeuronProduction::getActionList(const vector<double> param) {
+	list<ActionP> l;
+	ActionP ap;
+	ap.action = this;
+	ap.params = param;
+	l.push_back(ap);
+	return l;
+	
+}
+
+const SString NeuronProduction::getF8Representation() {
+	return this->body;
+}
+
+Production::Production() {
+	this->ignoreParams = false;
+}
+
+/**
+ * Zwracamy puste, bo co innego mamy zrobić?
+ */
+const SString Production::getF1Genotype(const vector<double> params) {
+	return SString("");
+}
+
+const list<ActionP> Production::getActionList(const vector<double> params) {
+	list<ActionP> l;
+#if CONV_DEBUG > 1
+	cout << "params.size(): " << params.size() << ", this->parameters.size(): " << this->parameters.size() << endl;
+#endif
+	for (int i = 0; i < params.size() && i < this->parameters.size(); i++) {
+		this->parameters.setValue(i + 1, params[i]);
+	}
+	
+	//jedziemy po podprodukcjach
+	for (vector<SubProduction>::iterator subProdIter = this->subproductions.begin();
+		 subProdIter != this->subproductions.end(); subProdIter++) {
+#if CONV_DEBUG > 1
+		cout << "this->subproductions.size(): " << this->subproductions.size() << endl;
+#endif
+		SubProduction &sp = *subProdIter;
+		bool conditionsOK = true;
+		//sprawdzenie warunków dla danej podprodukcji
+		for (vector<Condition>::iterator condIter = sp.conditions.begin();
+			 condIter != sp.conditions.end(); condIter++) {
+			if (conditionsOK == false) {
+				break; //bo dalsze sprawdzanie i tak nie ma sensu
+			}
+			Condition &c = *condIter;
+			switch (c.relation) {
+				case r_greater:
+					if (this->parameters.getValue(c.parameter) <= c.value) {
+						conditionsOK = false;
+					}
+					break;
+					case r_greaterEqual:
+					if (this->parameters.getValue(c.parameter) < c.value) {
+						conditionsOK = false;
+					}
+					break;
+					case r_less:
+					if (this->parameters.getValue(c.parameter) >= c.value) {
+						conditionsOK = false;
+					}
+					break;
+					case r_lessEqual:
+					if (this->parameters.getValue(c.parameter) > c.value) {
+						conditionsOK = false;
+					}
+					break;
+					case r_equal:
+					if (this->parameters.getValue(c.parameter) != c.value) {
+						conditionsOK = false;
+					}
+					break;
+					case r_different:
+					if (this->parameters.getValue(c.parameter) == c.value) {
+						conditionsOK = false;
+					}
+					break;
+			}	
+		}
+		if (conditionsOK) {
+			//jedziemy po każdej akcji w danej podprodukcji
+			for (int i = 0; i < sp.actions.size(); i++) {
+#if CONV_DEBUG > 1
+				cout << "sp.actions.size(): " << sp.actions.size() << endl;
+#endif
+				Action *action = sp.actions[i].action;
+				vector<SString> strParams = sp.actions[i].params;
+				vector<double> params;
+				//podmieniamy nazwy parametrów na ich wartości
+				for (vector<SString>::iterator paramIter = strParams.begin();
+					 paramIter != strParams.end(); paramIter++) {
+					SString parameter;
+					SString element;
+					int pos = 0;
+					while ((*paramIter).getNextToken(pos, element, ';')) {
+						if (element[0] == 'n') {
+							double val = this->parameters.getValue(element);
+							parameter += SString::valueOf(val) + ";";
+						} else {
+							parameter += element + ";";
+						}
+					}
+					params.push_back(parseExpression(parameter));
+				}
+				
+				ActionP ap;
+				ap.action = action;
+				ap.params = params;
+				l.push_back(ap);
+			}
+		}
+	}
+	
+	return l;
+}
+
+const SString Production::getF8Representation() {
+	return this->name;
+}
+
+vector<SString> GenoConv_F8ToF1::readProductionNames(const SString &in) {
+	vector<SString> names;
+	SString line;
+	int pos = 0;
+	bool afterFirstProd = false;
+	//ParsingStatus status = firstLine;
+	while (in.getNextToken(pos, line, '\n')) {
+#if CONV_DEBUG > 1
+		std::cout << "### Linia: " << line << std::endl;
+#endif
+		if (line.startsWith("P") && line.indexOf('(', 0) == -1) {
+			afterFirstProd = true;
+			continue;
+		}
+		if (!afterFirstProd) {
+			continue;
+		}
+		int lParenIndex = line.indexOf('(', 0);
+		if (line.startsWith("P") && lParenIndex != -1) {
+			SString prodName = line.substr(0, lParenIndex);
+#if CONV_DEBUG > 1
+			std::cout << "###Produkcja: " << prodName << std::endl;
+#endif
+			names.push_back(prodName);
+		}
+	}
+	return names;
+}
+
+bool GenoConv_F8ToF1::checkSyntax(const char *geno) {
+	return this->parseInput(geno, NULL);
+}
+
+SString GenoConv_F8ToF1::convert(SString &in, MultiMap *mmap) {
+#if CONV_DEBUG > 0
+	cout << "convert() start" << endl;
+#endif
+	SString dst = "";
+	const char* src = in;
+	
+	if (in.len() < 1 && !this->checkSyntax(src)) {
+		return SString();
+	}
+	
+	Lsystem *lsystem = this->createLsystem(in);
+	if (lsystem == NULL) {
+		return SString();
+	}
+	if (lsystem->firstProductionName.empty()) {
+		return SString();
+	}
+	
+#if CONV_DEBUG > 0
+	for (map<string, Production*>::iterator i1 = lsystem->productions.begin(); i1 != lsystem->productions.end(); i1++) {
+		Production *p = i1->second;
+		cout << "Production: " << p->name << endl;
+		for (vector<SubProduction>::iterator i2 = p->subproductions.begin(); i2 != p->subproductions.end(); i2++) {
+			SubProduction sp = *i2;
+			cout << "\tConditions" << endl;
+			for (vector<Condition>::iterator i3 = sp.conditions.begin(); i3 != sp.conditions.end(); i3++) {
+				cout << "\t\t" << *i3 << endl;
+			}
+			cout << "\tAction : params" << endl;
+			for (int i = 0; i < sp.actions.size(); i++) {
+				Action *a = sp.actions[i].action;
+				vector<SString> strParams = sp.actions[i].params;
+				cout << "\t\t" << a->name << " : ";
+				for (vector<SString>::iterator i4 = strParams.begin(); i4 != strParams.end(); i4++) {
+					cout << *i4 << ", ";
+				}
+				cout << endl;
+			}
+		}
+	}
+#endif
+#if CONV_DEBUG > 1
+	cout << "&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&" << endl;
+#endif
+	
+	//cout << "convert() 1" << endl;
+	//ustawienie zmiennych dla początkowej produkcji
+	Production *firstProduction = lsystem->productions[lsystem->firstProductionName];
+	vector<double> params;
+	params.reserve(lsystem->startParams.size());
+	//cout << "startParams->size: " << lsystem->startParams.size() << endl;
+	for (map<string, double>::iterator iter = lsystem->startParams.begin(); 
+		 iter != lsystem->startParams.end(); iter++) {
+		int position = firstProduction->parameters.getParameterPosition(stringToSString(iter->first));
+		//cout << "position of " << iter->first << ": " << position << endl;
+		//params.insert(params.begin() + (position - 1), iter->second);
+		params[position - 1] = iter->second;
+	}
+	
+	//cout << "convert() 2" << endl;
+	
+	ActionP ap;
+	ap.action = firstProduction;
+	ap.params = params;
+	
+	list<ActionP> actionList;
+	actionList.push_back(ap);
+	
+	//cout << "iterations: " << lsystem->iterations << endl;
+	for (int i = 0; i < lsystem->iterations; i++) {
+		//cout << "convert() 2.1" << endl;
+		list<ActionP> newList;
+		for (list<ActionP>::iterator iter = actionList.begin(); iter != actionList.end(); iter++) {
+			//cout << "convert() 2.1.1" << endl;
+			Action *a = (*iter).action;
+			vector<double> p = (*iter).params;
+			if (a != NULL) {
+				list<ActionP> tmpList = a->getActionList(p);
+				newList.insert(newList.end(), tmpList.begin(), tmpList.end());
+			}
+		}
+		actionList = newList;
+	}
+	
+#if CONV_DEBUG > 1
+	cout << "&&&&&&&&&&&&&&&&&&&&& ^ &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&" << endl;
+	for (list<ActionP>::iterator it = actionList.begin(); it != actionList.end(); it++) {
+		cout << (*it).action->name << "(";
+		for (vector<double>::iterator it2 = (*it).params.begin(); it2 != (*it).params.end(); it2++) {
+			cout << *it2 << ", ";
+		}
+		cout << ")" << endl;
+	}
+	cout << "&&&&&&&&&&&&&&&&&&&&& ^ &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&" << endl;
+#endif	
+	for (list<ActionP>::iterator iter = actionList.begin(); iter != actionList.end(); iter++) {
+		Action *a = (*iter).action;
+		vector<double> p = (*iter).params;
+		if (a != NULL) {
+			dst += a->getF1Genotype(p);
+		}
+	}
+	
+	delete lsystem;
+	
+#if CONV_DEBUG > 0
+	cout << "convert() end" << endl;
+#endif
+	return dst;
+}
+
+//Lsystem* GenoConv_F8ToF1::createLsystem(const SString &in) {
+Lsystem* GenoConv_F8ToF1::createLsystem(SString in) {
+#if CONV_DEBUG > 0
+	cout << "createLsystem() start" << endl;
+#endif
+	Lsystem *lsys = new Lsystem();
+	
+	//wczytujemy nazwy produkcji i tworzymy wstępnie dla nich obiekty
+	vector<SString> names = this->readProductionNames(in);
+	for (vector<SString>::iterator nameIter = names.begin(); nameIter != names.end(); nameIter++) {
+		Production *production = new Production();
+		production->name = *nameIter;
+		//lsystem->productions.insert(make_pair(*nameIter, production));
+		lsys->productions[sstringToString(*nameIter)] = production;
+	}
+	
+#if CONV_DEBUG > 1
+	cout << "lsystemprodsize " << lsys->productions.size() << endl;
+	for (map<string, Production*>::iterator iii = lsys->productions.begin(); iii != lsys->productions.end(); iii++) {
+		cout << "PPP '" << iii->first << "' adr " << (long) &(iii->second) << endl;
+	}
+#endif
+	
+	const char* src = in;
+	bool result = this->parseInput(src, lsys);
+	if (!result) {
+		delete lsys;
+		return NULL;
+	}
+	
+#if CONV_DEBUG > 1
+	
+	cout << "@@@@@ Przeparsowane" << endl;
+	
+	cout << "&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&" << endl;
+#endif
+#if CONV_DEBUG > 0
+	cout << "createLsystem() end" << endl;
+#endif
+	return lsys;
+}
+
+bool GenoConv_F8ToF1::parseInput(const char* src, Lsystem* lsys) {
+	//inicjalizacja zmiennych parsera
+	int yv;
+	istringstream input;
+	input.str(string(src));
+	ostringstream output;
+	yyFlexLexer scanner(&input, &output);
+	bool syntaxOk = false;
+	void* pParser = prs::ParseAlloc(malloc, lsys, (lsys == NULL), &syntaxOk);
+	struct prs::Token t0;
+	//t0.strValue = "";
+	memset(t0.strArrValue, 0, 30);
+	extern YYSTYPE yylval;
+	
+	//parsowanie wejścia
+	// on EOF yylex will return 0
+	while((yv = scanner.yylex()) != 0) {
+#if CONV_DEBUG > 1
+		cout << " yylex() " << yv << " yylval.strVal " << yylval.strVal << endl;
+#endif
+		memset(t0.strArrValue, 0, 30);
+		sprintf(t0.strArrValue, yylval.strVal);
+		prs::Parse (pParser, yv, t0);
+	}
+	prs::Parse(pParser, 0, t0);
+	prs::ParseFree(pParser, free);
+	
+	return syntaxOk;	
+}
+#undef CONV_DEBUG
Index: cpp/f8-to-f1/conv_f8tof1.h
===================================================================
--- cpp/f8-to-f1/conv_f8tof1.h	(revision 1)
+++ cpp/f8-to-f1/conv_f8tof1.h	(revision 1)
@@ -0,0 +1,181 @@
+/*
+ *  conv_f8tof1.h
+ *  L-systemToF1
+ *
+ *  Created by Maciej Wajcht on 08-03-21.
+ *  Copyright 2008 __MyCompanyName__. All rights reserved.
+ *
+ */
+
+#ifndef _CONV_F8_TO_F1_H
+#define _CONV_F8_TO_F1_H
+
+#include <map>
+#include <vector>
+#include <string>
+#include <list>
+#include <iostream>
+#include "genoconv.h"
+#include "model.h"
+
+using std::ostream;
+using std::vector;
+using std::list;
+using std::string;
+using std::map;
+
+enum RelationType {
+	r_greater,
+	r_greaterEqual,
+	r_less,
+	r_lessEqual,
+	r_equal,
+	r_different
+};
+
+class Condition {
+public:
+	RelationType relation;
+	SString parameter;
+	double value;
+	
+	friend ostream& operator<<(ostream& os, const Condition& c);
+};
+
+class ActionP;
+
+class Action {
+public:
+	SString name;
+	bool ignoreParams;
+	virtual const SString getF1Genotype(vector<double> params) = 0;
+	virtual const list<ActionP> getActionList(const vector<double> params) = 0;
+	virtual const SString getF8Representation() = 0;
+	virtual ~Action() {}
+};
+
+class ActionStrP {
+public:
+	Action *action;
+	vector<SString> params;
+};
+
+class ActionP {
+public:
+	Action *action;
+	vector<double> params;
+};
+
+class SubProduction {
+public:
+	vector<Condition> conditions;
+	vector<ActionStrP> actions;
+};
+
+class PrimitiveProduction : public Action {
+public:
+	PrimitiveProduction(const SString command);
+	const SString getF1Genotype(const vector<double> params);
+	const list<ActionP> getActionList(const vector<double> params);
+	const SString getF8Representation();
+protected:
+	SString f1command;
+	SString f8command;
+};
+
+class ParamProduction : public Action {
+public:
+	ParamProduction(const SString paramName);
+	const SString getF1Genotype(const vector<double> params);
+	const list<ActionP> getActionList(const vector<double> params);
+	const SString getF8Representation();
+protected:
+	SString paramName;
+};
+
+class NeuronProduction : public Action {
+public:
+	NeuronProduction(SString body);
+	const SString getF1Genotype(const vector<double> params);
+	const list<ActionP> getActionList(const vector<double> params);
+	const SString getF8Representation();
+protected:
+	SString body;
+};
+
+/**
+ * Pozycje liczone od 1 a nie od 0!
+ */
+class ParameterCollection {
+public:
+	const double getValue(int position);
+	const double getValue(SString name);
+	const SString getParameterName(int position);
+	const int getParameterPosition(SString name); //zwróci index liczony od 1!
+	void setValue(int position, double value);
+	void setValue(SString name, double value);
+	void addParameter(SString name, int position = -1, double value = 0.0);
+	const int size();
+	void removeParameter(int position);
+	void removeParameter(SString name);
+	bool paramExist(SString name);
+protected:
+	vector<string> parameters;
+	map<string, double> paramValues;
+};
+
+class Production : public Action {
+public:
+	ParameterCollection parameters;
+	vector<SubProduction> subproductions;
+	
+	Production();
+	~Production() {};
+	const SString getF1Genotype(const vector<double> params);
+	const list<ActionP> getActionList(const vector<double> params);
+	const SString getF8Representation();
+};
+
+class Lsystem {
+public:
+	int iterations;
+	map<string, double> startParams;
+	map<string, Production*> productions;
+	vector<NeuronProduction*> neuronProductions;
+	string firstProductionName;
+	
+	Lsystem();
+	~Lsystem();
+	PrimitiveProduction* getPrimitiveProduction(SString name);
+	ParamProduction* getParamProduction(SString name);
+	SString toString();
+	vector<Action*> getAllActions(bool normal, bool primitives, bool params, bool neurons);
+protected:
+	map<string, PrimitiveProduction*> primitiveProductions;
+	map<string, ParamProduction*> paramProductions;
+	
+	void removeEmptySubproductionsAndProductions();
+};
+
+class GenoConv_F8ToF1 : public GenoConverter {
+public:
+	GenoConv_F8ToF1() {
+		name = "f8 to f1 converter";
+		in_format = '8';
+		out_format = '1';
+		mapsupport = 0;
+		info = "ble";
+	}
+	
+	~GenoConv_F8ToF1() {}
+	
+	SString convert(SString &in, MultiMap *map);
+	bool checkSyntax(const char *geno);
+	vector<SString> readProductionNames(const SString &in);
+	//Lsystem* createLsystem(const SString &in);
+	Lsystem* createLsystem(SString in);
+protected:
+	bool parseInput(const char* src, Lsystem* lsys);
+};
+
+#endif
Index: cpp/f8-to-f1/conv_f8tof1_grammar.c
===================================================================
--- cpp/f8-to-f1/conv_f8tof1_grammar.c	(revision 1)
+++ cpp/f8-to-f1/conv_f8tof1_grammar.c	(revision 1)
@@ -0,0 +1,1766 @@
+/* Driver template for the LEMON parser generator.
+** The author disclaims copyright to this source code.
+*/
+/* First off, code is include which follows the "include" declaration
+** in the input file. */
+#include <stdio.h>
+#include <assert.h>
+#line 1 "conv_f8tof1_grammar.y"
+
+#include <iostream>
+#include <sstream>
+#include "lemonglobal.h"
+#include "conv_f8tof1.h"
+#include "conv_f8_utils.h"
+#define PARSER_DEBUG 0
+#line 18 "conv_f8tof1_grammar.c"
+/* Next is all token values, in a form suitable for use by makeheaders.
+** This section will be null unless lemon is run with the -m switch.
+*/
+/* 
+** These constants (all generated automatically by the parser generator)
+** specify the various kinds of tokens (terminals) that the parser
+** understands. 
+**
+** Each symbol here is a terminal symbol in the grammar.
+*/
+/* Make sure the INTERFACE macro is defined.
+*/
+#ifndef INTERFACE
+# define INTERFACE 1
+#endif
+/* The next thing included is series of defines which control
+** various aspects of the generated parser.
+**    YYCODETYPE         is the data type used for storing terminal
+**                       and nonterminal numbers.  "unsigned char" is
+**                       used if there are fewer than 250 terminals
+**                       and nonterminals.  "int" is used otherwise.
+**    YYNOCODE           is a number of type YYCODETYPE which corresponds
+**                       to no legal terminal or nonterminal number.  This
+**                       number is used to fill in empty slots of the hash 
+**                       table.
+**    YYFALLBACK         If defined, this indicates that one or more tokens
+**                       have fall-back values which should be used if the
+**                       original value of the token will not parse.
+**    YYACTIONTYPE       is the data type used for storing terminal
+**                       and nonterminal numbers.  "unsigned char" is
+**                       used if there are fewer than 250 rules and
+**                       states combined.  "int" is used otherwise.
+**    ParseTOKENTYPE     is the data type used for minor tokens given 
+**                       directly to the parser from the tokenizer.
+**    YYMINORTYPE        is the data type used for all minor tokens.
+**                       This is typically a union of many types, one of
+**                       which is ParseTOKENTYPE.  The entry in the union
+**                       for base tokens is called "yy0".
+**    YYSTACKDEPTH       is the maximum depth of the parser's stack.  If
+**                       zero the stack is dynamically sized using realloc()
+**    ParseARG_SDECL     A static variable declaration for the %extra_argument
+**    ParseARG_PDECL     A parameter declaration for the %extra_argument
+**    ParseARG_STORE     Code to store %extra_argument into yypParser
+**    ParseARG_FETCH     Code to extract %extra_argument from yypParser
+**    YYNSTATE           the combined number of states.
+**    YYNRULE            the number of rules in the grammar
+**    YYERRORSYMBOL      is the code number of the error symbol.  If not
+**                       defined, then do no error processing.
+*/
+#define YYCODETYPE unsigned char
+#define YYNOCODE 51
+#define YYACTIONTYPE unsigned char
+#define ParseTOKENTYPE Token
+typedef union {
+  ParseTOKENTYPE yy0;
+  ProductionTailToken yy11;
+  Token yy78;
+  ProdPieceToken yy89;
+} YYMINORTYPE;
+#ifndef YYSTACKDEPTH
+#define YYSTACKDEPTH 100
+#endif
+#define ParseARG_SDECL
+#define ParseARG_PDECL
+#define ParseARG_FETCH
+#define ParseARG_STORE
+#define YYNSTATE 91
+#define YYNRULE 47
+#define YY_NO_ACTION      (YYNSTATE+YYNRULE+2)
+#define YY_ACCEPT_ACTION  (YYNSTATE+YYNRULE+1)
+#define YY_ERROR_ACTION   (YYNSTATE+YYNRULE)
+
+/* Next are that tables used to determine what action to take based on the
+** current state and lookahead token.  These tables are used to implement
+** functions that take a state number and lookahead value and return an
+** action integer.  
+**
+** Suppose the action integer is N.  Then the action is determined as
+** follows
+**
+**   0 <= N < YYNSTATE                  Shift N.  That is, push the lookahead
+**                                      token onto the stack and goto state N.
+**
+**   YYNSTATE <= N < YYNSTATE+YYNRULE   Reduce by rule N-YYNSTATE.
+**
+**   N == YYNSTATE+YYNRULE              A syntax error has occurred.
+**
+**   N == YYNSTATE+YYNRULE+1            The parser accepts its input.
+**
+**   N == YYNSTATE+YYNRULE+2            No such action.  Denotes unused
+**                                      slots in the yy_action[] table.
+**
+** The action table is constructed as a single large table named yy_action[].
+** Given state S and lookahead X, the action is computed as
+**
+**      yy_action[ yy_shift_ofst[S] + X ]
+**
+** If the index value yy_shift_ofst[S]+X is out of range or if the value
+** yy_lookahead[yy_shift_ofst[S]+X] is not equal to X or if yy_shift_ofst[S]
+** is equal to YY_SHIFT_USE_DFLT, it means that the action is not in the table
+** and that yy_default[S] should be used instead.  
+**
+** The formula above is for computing the action when the lookahead is
+** a terminal symbol.  If the lookahead is a non-terminal (as occurs after
+** a reduce action) then the yy_reduce_ofst[] array is used in place of
+** the yy_shift_ofst[] array and YY_REDUCE_USE_DFLT is used in place of
+** YY_SHIFT_USE_DFLT.
+**
+** The following are the tables generated in this section:
+**
+**  yy_action[]        A single table containing all actions.
+**  yy_lookahead[]     A table containing the lookahead for each entry in
+**                     yy_action.  Used to detect hash collisions.
+**  yy_shift_ofst[]    For each state, the offset into yy_action for
+**                     shifting terminals.
+**  yy_reduce_ofst[]   For each state, the offset into yy_action for
+**                     shifting non-terminals after a reduce.
+**  yy_default[]       Default action for each state.
+*/
+static const YYACTIONTYPE yy_action[] = {
+ /*     0 */    40,    4,   23,   24,   25,   26,   27,   28,   64,   67,
+ /*    10 */    31,   71,   44,   55,    4,   41,   34,   82,   75,   64,
+ /*    20 */    65,   68,   70,   31,   65,   44,   84,    4,   41,   34,
+ /*    30 */    82,   75,   64,   65,   68,   70,   69,   65,   44,   20,
+ /*    40 */    60,    4,   61,   56,    4,   47,    8,   68,   70,   46,
+ /*    50 */    69,   32,   44,   69,   49,   44,   59,   57,    4,   47,
+ /*    60 */    42,   68,   70,   85,   68,   70,   38,   69,   76,   44,
+ /*    70 */    10,   45,   39,   77,   58,   15,   14,    5,   68,   70,
+ /*    80 */    65,   71,   72,   73,   12,   13,   15,   14,   60,    9,
+ /*    90 */    61,   91,   78,    6,   60,   48,   61,   53,    1,   33,
+ /*   100 */    35,   10,   45,   39,   79,   33,   66,   80,   12,   13,
+ /*   110 */    15,   14,  139,   16,   60,   60,   61,   61,   52,   60,
+ /*   120 */    60,   61,   61,   81,   17,   36,   37,   54,   22,   51,
+ /*   130 */    62,   63,   30,   18,   50,    3,    2,   43,   74,   11,
+ /*   140 */    75,   88,    7,   19,   21,   83,   18,   50,   86,   29,
+ /*   150 */    87,   89,   90,
+};
+static const YYCODETYPE yy_lookahead[] = {
+ /*     0 */    27,   28,   13,   14,   15,   16,   17,   18,   21,   11,
+ /*    10 */    37,   23,   39,   27,   28,   42,   43,   44,   45,   21,
+ /*    20 */    22,   48,   49,   37,   22,   39,   11,   28,   42,   43,
+ /*    30 */    44,   45,   21,   22,   48,   49,   37,   22,   39,   32,
+ /*    40 */    35,   28,   37,   44,   28,   37,    1,   48,   49,   41,
+ /*    50 */    37,   46,   39,   37,    7,   39,   11,   44,   28,   37,
+ /*    60 */    44,   48,   49,   41,   48,   49,   34,   37,   35,   39,
+ /*    70 */    38,   39,   40,   35,   44,    4,    5,   19,   48,   49,
+ /*    80 */    22,   23,   24,   25,    2,    3,    4,    5,   35,   33,
+ /*    90 */    37,    0,   35,   11,   35,   39,   37,   34,    9,   46,
+ /*   100 */    47,   38,   39,   40,   35,   46,   47,   35,    2,    3,
+ /*   110 */     4,    5,   29,   30,   35,   35,   37,   37,   35,   35,
+ /*   120 */    35,   37,   37,   35,    1,   46,   46,    6,   31,   35,
+ /*   130 */    46,   46,   37,   36,   37,   12,    9,   20,   43,   10,
+ /*   140 */    45,   31,   10,   10,    1,   11,   36,   37,    6,    8,
+ /*   150 */     6,    6,    6,
+};
+#define YY_SHIFT_USE_DFLT (-14)
+#define YY_SHIFT_MAX 52
+static const short yy_shift_ofst[] = {
+ /*     0 */   -13,   58,   58,   58,   58,   58,   58,   -2,   11,  -12,
+ /*    10 */   -12,   11,   11,   11,   11,   11,    2,    2,    2,   15,
+ /*    20 */   -12,    2,   47,  -13,  -13,  -13,  -13,  -13,  -13,  -13,
+ /*    30 */   -11,  -11,   82,  106,  123,   45,   71,   71,   91,   89,
+ /*    40 */   121,  127,  117,  129,  132,  133,  134,  143,  142,  144,
+ /*    50 */   141,  145,  146,
+};
+#define YY_REDUCE_USE_DFLT (-28)
+#define YY_REDUCE_MAX 29
+static const signed char yy_reduce_ofst[] = {
+ /*     0 */    83,  -27,  -14,   -1,   13,   16,   30,   53,   59,   32,
+ /*    10 */    63,    5,   79,   80,   84,   85,   97,   95,  110,    8,
+ /*    20 */    56,   22,    7,   33,   38,   57,   69,   72,   88,   94,
+};
+static const YYACTIONTYPE yy_default[] = {
+ /*     0 */   138,  117,  117,  117,  117,  117,  117,  138,  138,   98,
+ /*    10 */    98,  138,  138,  138,  138,  138,   95,  138,   95,  138,
+ /*    20 */   138,  138,  138,  138,  138,  138,  138,  138,  138,  138,
+ /*    30 */   138,  123,  138,  125,  138,  138,  129,  130,  138,  138,
+ /*    40 */   138,  106,  138,  138,  138,  138,  138,  104,  138,  138,
+ /*    50 */   138,  138,  138,   97,  100,  105,  107,  118,  119,  120,
+ /*    60 */   127,  128,  131,  132,  133,  134,  126,  121,  122,  123,
+ /*    70 */   124,  135,  136,  137,  109,  110,  111,  112,  113,  114,
+ /*    80 */   115,  116,  108,  101,  102,  103,   99,   93,   94,   96,
+ /*    90 */    92,
+};
+#define YY_SZ_ACTTAB (int)(sizeof(yy_action)/sizeof(yy_action[0]))
+
+/* The next table maps tokens into fallback tokens.  If a construct
+** like the following:
+** 
+**      %fallback ID X Y Z.
+**
+** appears in the grammer, then ID becomes a fallback token for X, Y,
+** and Z.  Whenever one of the tokens X, Y, or Z is input to the parser
+** but it does not parse, the type of the token is changed to ID and
+** the parse is retried before an error is thrown.
+*/
+#ifdef YYFALLBACK
+static const YYCODETYPE yyFallback[] = {
+};
+#endif /* YYFALLBACK */
+
+/* The following structure represents a single element of the
+** parser's stack.  Information stored includes:
+**
+**   +  The state number for the parser at this level of the stack.
+**
+**   +  The value of the token stored at this level of the stack.
+**      (In other words, the "major" token.)
+**
+**   +  The semantic value stored at this level of the stack.  This is
+**      the information used by the action routines in the grammar.
+**      It is sometimes called the "minor" token.
+*/
+struct yyStackEntry {
+  int stateno;       /* The state-number */
+  int major;         /* The major token value.  This is the code
+                     ** number for the token at this stack level */
+  YYMINORTYPE minor; /* The user-supplied minor token value.  This
+                     ** is the value of the token  */
+};
+typedef struct yyStackEntry yyStackEntry;
+
+/* The state of the parser is completely contained in an instance of
+** the following structure */
+struct yyParser {
+  int yyidx;                    /* Index of top element in stack */
+  int yyerrcnt;                 /* Shifts left before out of the error */
+  ParseARG_SDECL                /* A place to hold %extra_argument */
+#if YYSTACKDEPTH<=0
+  int yystksz;                  /* Current side of the stack */
+  yyStackEntry *yystack;        /* The parser's stack */
+#else
+  yyStackEntry yystack[YYSTACKDEPTH];  /* The parser's stack */
+#endif
+};
+typedef struct yyParser yyParser;
+
+#ifndef NDEBUG
+#include <stdio.h>
+static FILE *yyTraceFILE = 0;
+static char *yyTracePrompt = 0;
+#endif /* NDEBUG */
+
+#ifndef NDEBUG
+/* 
+** Turn parser tracing on by giving a stream to which to write the trace
+** and a prompt to preface each trace message.  Tracing is turned off
+** by making either argument NULL 
+**
+** Inputs:
+** <ul>
+** <li> A FILE* to which trace output should be written.
+**      If NULL, then tracing is turned off.
+** <li> A prefix string written at the beginning of every
+**      line of trace output.  If NULL, then tracing is
+**      turned off.
+** </ul>
+**
+** Outputs:
+** None.
+*/
+void ParseTrace(FILE *TraceFILE, char *zTracePrompt){
+  yyTraceFILE = TraceFILE;
+  yyTracePrompt = zTracePrompt;
+  if( yyTraceFILE==0 ) yyTracePrompt = 0;
+  else if( yyTracePrompt==0 ) yyTraceFILE = 0;
+}
+#endif /* NDEBUG */
+
+#ifndef NDEBUG
+/* For tracing shifts, the names of all terminals and nonterminals
+** are required.  The following table supplies these names */
+static const char *const yyTokenName[] = { 
+  "$",             "COMMA",         "PLUS",          "MINUS",       
+  "DIV",           "TIMES",         "NEWLINE",       "DELIMETER",   
+  "ASSIGN",        "SEMICOLON",     "LPAREN",        "RPAREN",      
+  "PIPE",          "LESS",          "LESS_EQUAL",    "NOT_EQUAL",   
+  "EQUAL",         "GREATER_EQUAL",  "GREATER",       "FORLOOP_BEGIN",
+  "FORLOOP_END",   "DOUBLE_VAL",    "PARAM_NAME",    "PROD_NAME",   
+  "COMMAND",       "NEURON",        "error",         "production_tail",
+  "prod_piece",    "program",       "counter",       "start_params",
+  "delim",         "first_prod",    "productions",   "double_val",  
+  "start_parameter",  "param_name",    "production",    "prod_name",   
+  "production_head",  "prod_params",   "subproduction",  "conditions",  
+  "real_prod",     "condition",     "single_val",    "multiple_val",
+  "command",       "neuron",      
+};
+#endif /* NDEBUG */
+
+#ifndef NDEBUG
+/* For tracing reduce actions, the names of all rules are required.
+*/
+static const char *const yyRuleName[] = {
+ /*   0 */ "program ::= counter start_params delim first_prod productions",
+ /*   1 */ "counter ::= double_val NEWLINE",
+ /*   2 */ "delim ::= DELIMETER NEWLINE",
+ /*   3 */ "start_params ::= start_parameter start_params",
+ /*   4 */ "start_params ::=",
+ /*   5 */ "start_parameter ::= param_name ASSIGN double_val NEWLINE",
+ /*   6 */ "productions ::= production productions",
+ /*   7 */ "productions ::=",
+ /*   8 */ "first_prod ::= prod_name NEWLINE",
+ /*   9 */ "production ::= production_head SEMICOLON production_tail NEWLINE",
+ /*  10 */ "production_head ::= prod_name LPAREN prod_params RPAREN",
+ /*  11 */ "production_head ::= prod_name LPAREN RPAREN",
+ /*  12 */ "prod_params ::= param_name COMMA prod_params",
+ /*  13 */ "prod_params ::= param_name",
+ /*  14 */ "production_tail ::= subproduction SEMICOLON production_tail",
+ /*  15 */ "production_tail ::= subproduction",
+ /*  16 */ "subproduction ::= conditions PIPE real_prod",
+ /*  17 */ "subproduction ::= real_prod",
+ /*  18 */ "conditions ::= conditions COMMA conditions",
+ /*  19 */ "conditions ::= condition",
+ /*  20 */ "condition ::= param_name LESS double_val",
+ /*  21 */ "condition ::= param_name LESS_EQUAL double_val",
+ /*  22 */ "condition ::= param_name NOT_EQUAL double_val",
+ /*  23 */ "condition ::= param_name EQUAL double_val",
+ /*  24 */ "condition ::= param_name GREATER_EQUAL double_val",
+ /*  25 */ "condition ::= param_name GREATER double_val",
+ /*  26 */ "real_prod ::=",
+ /*  27 */ "real_prod ::= prod_piece real_prod",
+ /*  28 */ "real_prod ::= FORLOOP_BEGIN real_prod FORLOOP_END LPAREN single_val RPAREN real_prod",
+ /*  29 */ "prod_piece ::= prod_name LPAREN multiple_val RPAREN",
+ /*  30 */ "prod_piece ::= prod_name LPAREN RPAREN",
+ /*  31 */ "prod_piece ::= command",
+ /*  32 */ "prod_piece ::= param_name",
+ /*  33 */ "prod_piece ::= neuron",
+ /*  34 */ "multiple_val ::= single_val",
+ /*  35 */ "multiple_val ::= multiple_val COMMA multiple_val",
+ /*  36 */ "single_val ::= double_val",
+ /*  37 */ "single_val ::= param_name",
+ /*  38 */ "single_val ::= single_val PLUS single_val",
+ /*  39 */ "single_val ::= single_val MINUS single_val",
+ /*  40 */ "single_val ::= single_val TIMES single_val",
+ /*  41 */ "single_val ::= single_val DIV single_val",
+ /*  42 */ "double_val ::= DOUBLE_VAL",
+ /*  43 */ "param_name ::= PARAM_NAME",
+ /*  44 */ "prod_name ::= PROD_NAME",
+ /*  45 */ "command ::= COMMAND",
+ /*  46 */ "neuron ::= NEURON",
+};
+#endif /* NDEBUG */
+
+
+#if YYSTACKDEPTH<=0
+/*
+** Try to increase the size of the parser stack.
+*/
+static void yyGrowStack(yyParser *p){
+  int newSize;
+  yyStackEntry *pNew;
+
+  newSize = p->yystksz*2 + 100;
+  pNew = realloc(p->yystack, newSize*sizeof(pNew[0]));
+  if( pNew ){
+    p->yystack = pNew;
+    p->yystksz = newSize;
+#ifndef NDEBUG
+    if( yyTraceFILE ){
+      fprintf(yyTraceFILE,"%sStack grows to %d entries!\n",
+              yyTracePrompt, p->yystksz);
+    }
+#endif
+  }
+}
+#endif
+
+/* MW */
+Lsystem *lsys;
+bool syntaxOnly;
+bool *syntaxOk;
+
+/* 
+** This function allocates a new parser.
+** The only argument is a pointer to a function which works like
+** malloc.
+**
+** Inputs:
+** A pointer to the function used to allocate memory.
+**
+** Outputs:
+** A pointer to a parser.  This pointer is used in subsequent calls
+** to Parse and ParseFree.
+*/
+void *ParseAlloc(void *(*mallocProc)(size_t), Lsystem *lsystem, bool checkSyntaxOnly = false, bool *isSyntaxOk = NULL){
+  yyParser *pParser;
+  pParser = (yyParser*)(*mallocProc)( (size_t)sizeof(yyParser) );
+  if( pParser ){
+    pParser->yyidx = -1;
+#if YYSTACKDEPTH<=0
+    yyGrowStack(pParser);
+#endif
+	  //input = new Lsystem();
+	  lsys = lsystem;
+	  syntaxOnly = checkSyntaxOnly;
+	  syntaxOk = isSyntaxOk;
+  }
+  return pParser;
+}
+
+/* The following function deletes the value associated with a
+** symbol.  The symbol can be either a terminal or nonterminal.
+** "yymajor" is the symbol code, and "yypminor" is a pointer to
+** the value.
+*/
+static void yy_destructor(YYCODETYPE yymajor, YYMINORTYPE *yypminor){
+  switch( yymajor ){
+    /* Here is inserted the actions which take place when a
+    ** terminal or non-terminal is destroyed.  This can happen
+    ** when the symbol is popped from the stack during a
+    ** reduce or during error processing or when a parser is 
+    ** being destroyed before it is finished parsing.
+    **
+    ** Note: during a reduce, the only symbols destroyed are those
+    ** which appear on the RHS of the rule, but which are not used
+    ** inside the C code.
+    */
+    default:  break;   /* If no destructor action specified: do nothing */
+  }
+}
+
+/*
+** Pop the parser's stack once.
+**
+** If there is a destructor routine associated with the token which
+** is popped from the stack, then call it.
+**
+** Return the major token number for the symbol popped.
+*/
+static int yy_pop_parser_stack(yyParser *pParser){
+  YYCODETYPE yymajor;
+  yyStackEntry *yytos = &pParser->yystack[pParser->yyidx];
+
+  if( pParser->yyidx<0 ) return 0;
+#ifndef NDEBUG
+  if( yyTraceFILE && pParser->yyidx>=0 ){
+    fprintf(yyTraceFILE,"%sPopping %s\n",
+      yyTracePrompt,
+      yyTokenName[yytos->major]);
+  }
+#endif
+  yymajor = yytos->major;
+  yy_destructor( yymajor, &yytos->minor);
+  pParser->yyidx--;
+  return yymajor;
+}
+
+/* 
+** Deallocate and destroy a parser.  Destructors are all called for
+** all stack elements before shutting the parser down.
+**
+** Inputs:
+** <ul>
+** <li>  A pointer to the parser.  This should be a pointer
+**       obtained from ParseAlloc.
+** <li>  A pointer to a function used to reclaim memory obtained
+**       from malloc.
+** </ul>
+*/
+void ParseFree(
+  void *p,                    /* The parser to be deleted */
+  void (*freeProc)(void*)     /* Function used to reclaim memory */
+){
+  yyParser *pParser = (yyParser*)p;
+  if( pParser==0 ) return;
+  while( pParser->yyidx>=0 ) yy_pop_parser_stack(pParser);
+#if YYSTACKDEPTH<=0
+  free(pParser->yystack);
+#endif
+  (*freeProc)((void*)pParser);
+	//delete lsys;
+}
+
+/*
+** Find the appropriate action for a parser given the terminal
+** look-ahead token iLookAhead.
+**
+** If the look-ahead token is YYNOCODE, then check to see if the action is
+** independent of the look-ahead.  If it is, return the action, otherwise
+** return YY_NO_ACTION.
+*/
+static int yy_find_shift_action(
+  yyParser *pParser,        /* The parser */
+  YYCODETYPE iLookAhead     /* The look-ahead token */
+){
+  int i;
+  int stateno = pParser->yystack[pParser->yyidx].stateno;
+ 
+  if( stateno>YY_SHIFT_MAX || (i = yy_shift_ofst[stateno])==YY_SHIFT_USE_DFLT ){
+    return yy_default[stateno];
+  }
+  assert( iLookAhead!=YYNOCODE );
+  i += iLookAhead;
+  if( i<0 || i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){
+    if( iLookAhead>0 ){
+#ifdef YYFALLBACK
+      int iFallback;            /* Fallback token */
+      if( iLookAhead<sizeof(yyFallback)/sizeof(yyFallback[0])
+             && (iFallback = yyFallback[iLookAhead])!=0 ){
+#ifndef NDEBUG
+        if( yyTraceFILE ){
+          fprintf(yyTraceFILE, "%sFALLBACK %s => %s\n",
+             yyTracePrompt, yyTokenName[iLookAhead], yyTokenName[iFallback]);
+        }
+#endif
+        return yy_find_shift_action(pParser, iFallback);
+      }
+#endif
+#ifdef YYWILDCARD
+      {
+        int j = i - iLookAhead + YYWILDCARD;
+        if( j>=0 && j<YY_SZ_ACTTAB && yy_lookahead[j]==YYWILDCARD ){
+#ifndef NDEBUG
+          if( yyTraceFILE ){
+            fprintf(yyTraceFILE, "%sWILDCARD %s => %s\n",
+               yyTracePrompt, yyTokenName[iLookAhead], yyTokenName[YYWILDCARD]);
+          }
+#endif /* NDEBUG */
+          return yy_action[j];
+        }
+      }
+#endif /* YYWILDCARD */
+    }
+    return yy_default[stateno];
+  }else{
+    return yy_action[i];
+  }
+}
+
+/*
+** Find the appropriate action for a parser given the non-terminal
+** look-ahead token iLookAhead.
+**
+** If the look-ahead token is YYNOCODE, then check to see if the action is
+** independent of the look-ahead.  If it is, return the action, otherwise
+** return YY_NO_ACTION.
+*/
+static int yy_find_reduce_action(
+  int stateno,              /* Current state number */
+  YYCODETYPE iLookAhead     /* The look-ahead token */
+){
+  int i;
+  assert( stateno<=YY_REDUCE_MAX );
+  i = yy_reduce_ofst[stateno];
+  assert( i!=YY_REDUCE_USE_DFLT );
+  assert( iLookAhead!=YYNOCODE );
+  i += iLookAhead;
+  assert( i>=0 && i<YY_SZ_ACTTAB );
+  assert( yy_lookahead[i]==iLookAhead );
+  return yy_action[i];
+}
+
+/*
+** The following routine is called if the stack overflows.
+*/
+static void yyStackOverflow(yyParser *yypParser, YYMINORTYPE *yypMinor){
+   ParseARG_FETCH;
+   yypParser->yyidx--;
+#ifndef NDEBUG
+   if( yyTraceFILE ){
+     fprintf(yyTraceFILE,"%sStack Overflow!\n",yyTracePrompt);
+   }
+#endif
+   while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser);
+   /* Here code is inserted which will execute if the parser
+   ** stack every overflows */
+   ParseARG_STORE; /* Suppress warning about unused %extra_argument var */
+}
+
+/*
+** Perform a shift action.
+*/
+static void yy_shift(
+  yyParser *yypParser,          /* The parser to be shifted */
+  int yyNewState,               /* The new state to shift in */
+  int yyMajor,                  /* The major token to shift in */
+  YYMINORTYPE *yypMinor         /* Pointer ot the minor token to shift in */
+){
+  yyStackEntry *yytos;
+  yypParser->yyidx++;
+#if YYSTACKDEPTH>0 
+  if( yypParser->yyidx>=YYSTACKDEPTH ){
+    yyStackOverflow(yypParser, yypMinor);
+    return;
+  }
+#else
+  if( yypParser->yyidx>=yypParser->yystksz ){
+    yyGrowStack(yypParser);
+    if( yypParser->yyidx>=yypParser->yystksz ){
+      yyStackOverflow(yypParser, yypMinor);
+      return;
+    }
+  }
+#endif
+  yytos = &yypParser->yystack[yypParser->yyidx];
+  yytos->stateno = yyNewState;
+  yytos->major = yyMajor;
+  yytos->minor = *yypMinor;
+#ifndef NDEBUG
+  if( yyTraceFILE && yypParser->yyidx>0 ){
+    int i;
+    fprintf(yyTraceFILE,"%sShift %d\n",yyTracePrompt,yyNewState);
+    fprintf(yyTraceFILE,"%sStack:",yyTracePrompt);
+    for(i=1; i<=yypParser->yyidx; i++)
+      fprintf(yyTraceFILE," %s",yyTokenName[yypParser->yystack[i].major]);
+    fprintf(yyTraceFILE,"\n");
+  }
+#endif
+}
+
+/* The following table contains information about every rule that
+** is used during the reduce.
+*/
+static const struct {
+  YYCODETYPE lhs;         /* Symbol on the left-hand side of the rule */
+  unsigned char nrhs;     /* Number of right-hand side symbols in the rule */
+} yyRuleInfo[] = {
+  { 29, 5 },
+  { 30, 2 },
+  { 32, 2 },
+  { 31, 2 },
+  { 31, 0 },
+  { 36, 4 },
+  { 34, 2 },
+  { 34, 0 },
+  { 33, 2 },
+  { 38, 4 },
+  { 40, 4 },
+  { 40, 3 },
+  { 41, 3 },
+  { 41, 1 },
+  { 27, 3 },
+  { 27, 1 },
+  { 42, 3 },
+  { 42, 1 },
+  { 43, 3 },
+  { 43, 1 },
+  { 45, 3 },
+  { 45, 3 },
+  { 45, 3 },
+  { 45, 3 },
+  { 45, 3 },
+  { 45, 3 },
+  { 44, 0 },
+  { 44, 2 },
+  { 44, 7 },
+  { 28, 4 },
+  { 28, 3 },
+  { 28, 1 },
+  { 28, 1 },
+  { 28, 1 },
+  { 47, 1 },
+  { 47, 3 },
+  { 46, 1 },
+  { 46, 1 },
+  { 46, 3 },
+  { 46, 3 },
+  { 46, 3 },
+  { 46, 3 },
+  { 35, 1 },
+  { 37, 1 },
+  { 39, 1 },
+  { 48, 1 },
+  { 49, 1 },
+};
+
+static void yy_accept(yyParser*);  /* Forward Declaration */
+
+/*
+** Perform a reduce action and the shift that must immediately
+** follow the reduce.
+*/
+static void yy_reduce(
+  yyParser *yypParser,         /* The parser */
+  int yyruleno                 /* Number of the rule by which to reduce */
+){
+  int yygoto;                     /* The next state */
+  int yyact;                      /* The next action */
+  YYMINORTYPE yygotominor;        /* The LHS of the rule reduced */
+  yyStackEntry *yymsp;            /* The top of the parser's stack */
+  int yysize;                     /* Amount to pop the stack */
+  ParseARG_FETCH;
+  yymsp = &yypParser->yystack[yypParser->yyidx];
+#ifndef NDEBUG
+  if( yyTraceFILE && yyruleno>=0 
+        && yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) ){
+    fprintf(yyTraceFILE, "%sReduce [%s].\n", yyTracePrompt,
+      yyRuleName[yyruleno]);
+  }
+#endif /* NDEBUG */
+
+  /* Silence complaints from purify about yygotominor being uninitialized
+  ** in some cases when it is copied into the stack after the following
+  ** switch.  yygotominor is uninitialized when a rule reduces that does
+  ** not set the value of its left-hand side nonterminal.  Leaving the
+  ** value of the nonterminal uninitialized is utterly harmless as long
+  ** as the value is never used.  So really the only thing this code
+  ** accomplishes is to quieten purify.  
+  **
+  ** 2007-01-16:  The wireshark project (www.wireshark.org) reports that
+  ** without this code, their parser segfaults.  I'm not sure what there
+  ** parser is doing to make this happen.  This is the second bug report
+  ** from wireshark this week.  Clearly they are stressing Lemon in ways
+  ** that it has not been previously stressed...  (SQLite ticket #2172)
+  */
+  memset(&yygotominor, 0, sizeof(yygotominor));
+
+
+  switch( yyruleno ){
+  /* Beginning here are the reduction cases.  A typical example
+  ** follows:
+  **   case 0:
+  **  #line <lineno> <grammarfile>
+  **     { ... }           // User supplied code
+  **  #line <lineno> <thisfile>
+  **     break;
+  */
+      case 0: /* program ::= counter start_params delim first_prod productions */
+#line 18 "conv_f8tof1_grammar.y"
+{
+	*syntaxOk = true;	
+}
+#line 741 "conv_f8tof1_grammar.c"
+        break;
+      case 1: /* counter ::= double_val NEWLINE */
+#line 22 "conv_f8tof1_grammar.y"
+{
+	if (!syntaxOnly) {
+		{
+#if PARSER_DEBUG > 0
+			std::cout << "counter ::= double_val NEWLINE." << std::endl;
+#endif
+		}
+		lsys->iterations = (int) yymsp[-1].minor.yy78.dblValue; 
+	}
+}
+#line 755 "conv_f8tof1_grammar.c"
+        break;
+      case 2: /* delim ::= DELIMETER NEWLINE */
+      case 3: /* start_params ::= start_parameter start_params */
+      case 4: /* start_params ::= */
+      case 6: /* productions ::= production productions */
+      case 7: /* productions ::= */
+#line 33 "conv_f8tof1_grammar.y"
+{
+}
+#line 765 "conv_f8tof1_grammar.c"
+        break;
+      case 5: /* start_parameter ::= param_name ASSIGN double_val NEWLINE */
+#line 38 "conv_f8tof1_grammar.y"
+{ 
+	if (!syntaxOnly) {
+		{	
+#if PARSER_DEBUG > 0
+			std::cout << "start_parameter ::= param_name ASSIGN double_val NEWLINE." << std::endl;
+#endif
+		}
+		lsys->startParams[sstringToString(*(yymsp[-3].minor.yy78.strValue))] = yymsp[-1].minor.yy78.dblValue;
+#if PARSER_DEBUG > 0
+		cout << "**** " << lsys->startParams["n0"] << endl;
+		cout << "**** " << lsys->startParams["n1"] << endl;
+#endif
+		delete yymsp[-3].minor.yy78.strValue;
+	}
+}
+#line 784 "conv_f8tof1_grammar.c"
+        break;
+      case 8: /* first_prod ::= prod_name NEWLINE */
+#line 57 "conv_f8tof1_grammar.y"
+{ 
+	if (!syntaxOnly) {
+		{
+#if PARSER_DEBUG > 0
+			std::cout << "first_prod ::= prod_name NEWLINE." << std::endl;
+#endif
+		}
+		lsys->firstProductionName = sstringToString(*(yymsp[-1].minor.yy78.strValue));
+		delete yymsp[-1].minor.yy78.strValue;
+	}
+}
+#line 799 "conv_f8tof1_grammar.c"
+        break;
+      case 9: /* production ::= production_head SEMICOLON production_tail NEWLINE */
+#line 69 "conv_f8tof1_grammar.y"
+{ 
+	if (!syntaxOnly) {
+		{
+#if PARSER_DEBUG > 0
+			std::cout << "production ::= production_head SEMICOLON production_tail NEWLINE." << std::endl;
+#endif
+		}
+		Production *p = lsys->productions[sstringToString(*(yymsp[-3].minor.yy78.strValue))];
+		for (vector<SString>::iterator paramIter = yymsp[-3].minor.yy78.vectorStr->begin(); paramIter != yymsp[-3].minor.yy78.vectorStr->end(); paramIter++) {
+#if PARSER_DEBUG > 0
+			std::cout << "1.1 " << *paramIter << std::endl;
+			std::cout << *(yymsp[-3].minor.yy78.strValue) << " # " << (p == NULL) << " # " << true << std::endl;
+#endif
+			p->parameters.addParameter(*paramIter);
+		}
+		p->subproductions = *(yymsp[-1].minor.yy11.subproductions);
+		delete yymsp[-3].minor.yy78.strValue;
+		delete yymsp[-3].minor.yy78.vectorStr;
+		delete yymsp[-1].minor.yy11.subproductions;
+	}
+}
+#line 824 "conv_f8tof1_grammar.c"
+        break;
+      case 10: /* production_head ::= prod_name LPAREN prod_params RPAREN */
+#line 91 "conv_f8tof1_grammar.y"
+{
+	if (!syntaxOnly) {
+		{
+#if PARSER_DEBUG > 0
+			std::cout << "production_head ::= prod_name LPAREN prod_params RPAREN." << std::endl;
+#endif
+		}
+#if PARSER_DEBUG > 0
+		std::cout << "---------" << *(yymsp[-3].minor.yy78.strValue) << std::endl;
+#endif
+		yygotominor.yy78.strValue = new SString(*(yymsp[-3].minor.yy78.strValue));
+		yygotominor.yy78.vectorStr = new vector<SString>(*(yymsp[-1].minor.yy78.vectorStr));
+		delete yymsp[-3].minor.yy78.strValue;
+		delete yymsp[-1].minor.yy78.vectorStr;
+	}
+}
+#line 844 "conv_f8tof1_grammar.c"
+        break;
+      case 11: /* production_head ::= prod_name LPAREN RPAREN */
+#line 107 "conv_f8tof1_grammar.y"
+{
+	if (!syntaxOnly) {
+		{
+#if PARSER_DEBUG > 0
+			std::cout << "production_head ::= prod_name LPAREN RPAREN." << std::endl;
+#endif
+		}
+#if PARSER_DEBUG > 0
+		std::cout << "---------" << *(yymsp[-2].minor.yy78.strValue) << std::endl;
+#endif
+		yygotominor.yy78.strValue = new SString(*(yymsp[-2].minor.yy78.strValue));
+		yygotominor.yy78.vectorStr = new vector<SString>();
+		delete yymsp[-2].minor.yy78.strValue;
+	}
+}
+#line 863 "conv_f8tof1_grammar.c"
+        break;
+      case 12: /* prod_params ::= param_name COMMA prod_params */
+#line 123 "conv_f8tof1_grammar.y"
+{ 
+	if (!syntaxOnly) {
+		{
+#if PARSER_DEBUG > 0
+			std::cout << "prod_params ::= param_name COMMA prod_params." << std::endl;
+#endif
+		}
+		yygotominor.yy78.vectorStr = new vector<SString>();
+		yygotominor.yy78.vectorStr->push_back(*(yymsp[-2].minor.yy78.strValue));
+		for (vector<SString>::iterator iter = yymsp[0].minor.yy78.vectorStr->begin(); iter != yymsp[0].minor.yy78.vectorStr->end(); iter++) {
+			yygotominor.yy78.vectorStr->push_back(*iter);
+		}
+		delete yymsp[-2].minor.yy78.strValue;
+		delete yymsp[0].minor.yy78.vectorStr;
+	}
+}
+#line 883 "conv_f8tof1_grammar.c"
+        break;
+      case 13: /* prod_params ::= param_name */
+#line 139 "conv_f8tof1_grammar.y"
+{ 
+	if (!syntaxOnly) {
+		{
+#if PARSER_DEBUG > 0
+			std::cout << "prod_params ::= param_name." << std::endl;
+#endif
+		}
+		yygotominor.yy78.vectorStr = new vector<SString>();
+		yygotominor.yy78.vectorStr->push_back(*(yymsp[0].minor.yy78.strValue));
+		delete yymsp[0].minor.yy78.strValue;
+	}
+}
+#line 899 "conv_f8tof1_grammar.c"
+        break;
+      case 14: /* production_tail ::= subproduction SEMICOLON production_tail */
+#line 152 "conv_f8tof1_grammar.y"
+{
+	if (!syntaxOnly) {
+		{
+#if PARSER_DEBUG > 0
+			std::cout << "production_tail ::= subproduction SEMICOLON production_tail." << std::endl;
+#endif
+		}
+		SubProduction sp;
+		sp.conditions = *(yymsp[-2].minor.yy78.vectorConditions);
+		vector<ActionStrP> actions;
+		actions.reserve(yymsp[-2].minor.yy78.vectorActions->size());
+		for (int i = 0; i < yymsp[-2].minor.yy78.vectorActions->size() && i < yymsp[-2].minor.yy78.parameters->size(); i++) {
+			ActionStrP ap;
+			ap.action = (*(yymsp[-2].minor.yy78.vectorActions)).at(i);
+			ap.params = (*(yymsp[-2].minor.yy78.parameters)).at(i);
+			actions.push_back(ap);
+		}
+		sp.actions = actions;
+		yygotominor.yy11.subproductions = new vector<SubProduction>();
+		yygotominor.yy11.subproductions->push_back(sp);
+		for (vector<SubProduction>::iterator iter = yymsp[0].minor.yy11.subproductions->begin(); iter != yymsp[0].minor.yy11.subproductions->end(); iter++) {
+			yygotominor.yy11.subproductions->push_back(*iter);
+		}
+		delete yymsp[-2].minor.yy78.vectorConditions;
+		delete yymsp[-2].minor.yy78.vectorActions;
+		delete yymsp[-2].minor.yy78.parameters;
+		delete yymsp[0].minor.yy11.subproductions;
+	}
+}
+#line 932 "conv_f8tof1_grammar.c"
+        break;
+      case 15: /* production_tail ::= subproduction */
+#line 181 "conv_f8tof1_grammar.y"
+{
+	if (!syntaxOnly) {
+		{
+#if PARSER_DEBUG > 0
+			std::cout << "production_tail ::= subproduction." << std::endl;
+#endif
+		}
+		SubProduction sp;
+		sp.conditions = *(yymsp[0].minor.yy78.vectorConditions);
+		vector<ActionStrP> actions;
+		actions.reserve(yymsp[0].minor.yy78.vectorActions->size());
+		for (int i = 0; i < yymsp[0].minor.yy78.vectorActions->size() && i < yymsp[0].minor.yy78.parameters->size(); i++) {
+			ActionStrP ap;
+			ap.action = (*(yymsp[0].minor.yy78.vectorActions)).at(i);
+			ap.params = (*(yymsp[0].minor.yy78.parameters)).at(i);
+			actions.push_back(ap);
+		}
+		sp.actions = actions;
+		yygotominor.yy11.subproductions = new vector<SubProduction>();
+		yygotominor.yy11.subproductions->push_back(sp);
+		delete yymsp[0].minor.yy78.vectorConditions;
+		delete yymsp[0].minor.yy78.vectorActions;
+		delete yymsp[0].minor.yy78.parameters;
+	}
+}
+#line 961 "conv_f8tof1_grammar.c"
+        break;
+      case 16: /* subproduction ::= conditions PIPE real_prod */
+#line 207 "conv_f8tof1_grammar.y"
+{
+	if (!syntaxOnly) {
+		{
+#if PARSER_DEBUG > 0
+			std::cout << "subproduction ::= conditions PIPE real_prod." << std::endl;
+#endif
+		}
+		yygotominor.yy78.vectorConditions = new vector<Condition>(*(yymsp[-2].minor.yy78.vectorConditions));
+		yygotominor.yy78.vectorActions = new vector<Action*>(*(yymsp[0].minor.yy78.vectorActions));
+		yygotominor.yy78.parameters = new vector<vector<SString> >(*(yymsp[0].minor.yy78.parameters));
+		delete yymsp[-2].minor.yy78.vectorConditions;
+		delete yymsp[0].minor.yy78.vectorActions;
+		delete yymsp[0].minor.yy78.parameters;
+	}
+}
+#line 980 "conv_f8tof1_grammar.c"
+        break;
+      case 17: /* subproduction ::= real_prod */
+#line 222 "conv_f8tof1_grammar.y"
+{
+	if (!syntaxOnly) {
+		{
+#if PARSER_DEBUG > 0
+			std::cout << "subproduction ::= real_prod." << std::endl;
+#endif
+		}
+		yygotominor.yy78.vectorConditions = new vector<Condition>();
+		yygotominor.yy78.vectorActions = new vector<Action*>(*(yymsp[0].minor.yy78.vectorActions));
+		yygotominor.yy78.parameters = new vector<vector<SString> >(*(yymsp[0].minor.yy78.parameters));
+		delete yymsp[0].minor.yy78.vectorActions;
+		delete yymsp[0].minor.yy78.parameters;
+	}
+}
+#line 998 "conv_f8tof1_grammar.c"
+        break;
+      case 18: /* conditions ::= conditions COMMA conditions */
+#line 237 "conv_f8tof1_grammar.y"
+{ 
+	if (!syntaxOnly) {
+		{
+#if PARSER_DEBUG > 0
+			std::cout << "conditions ::= condition COMMA conditions." << std::endl;
+#endif
+		}
+		yygotominor.yy78.vectorConditions = new vector<Condition>(*(yymsp[-2].minor.yy78.vectorConditions));
+		for (vector<Condition>::iterator iter = yymsp[0].minor.yy78.vectorConditions->begin(); 
+			 iter != yymsp[0].minor.yy78.vectorConditions->end(); iter++) {
+			yygotominor.yy78.vectorConditions->push_back(*iter);
+		}	
+		delete yymsp[-2].minor.yy78.vectorConditions;
+		delete yymsp[0].minor.yy78.vectorConditions;
+	}
+}
+#line 1018 "conv_f8tof1_grammar.c"
+        break;
+      case 19: /* conditions ::= condition */
+#line 253 "conv_f8tof1_grammar.y"
+{ 
+	if (!syntaxOnly) {
+		{
+#if PARSER_DEBUG > 0
+			std::cout << "conditions ::= condition." << std::endl;
+#endif
+		}
+		yygotominor.yy78.vectorConditions = new vector<Condition>();
+		yygotominor.yy78.vectorConditions->push_back(*(yymsp[0].minor.yy78.cond));
+		delete yymsp[0].minor.yy78.cond;
+	}
+}
+#line 1034 "conv_f8tof1_grammar.c"
+        break;
+      case 20: /* condition ::= param_name LESS double_val */
+#line 266 "conv_f8tof1_grammar.y"
+{ 
+	if (!syntaxOnly) {
+		{
+#if PARSER_DEBUG > 0
+			std::cout << "condition ::= param_name LESS double_val." << std::endl;
+#endif
+		}
+		yygotominor.yy78.cond = new Condition();
+		yygotominor.yy78.cond->relation = r_less;
+		yygotominor.yy78.cond->parameter = *(yymsp[-2].minor.yy78.strValue);
+		yygotominor.yy78.cond->value = yymsp[0].minor.yy78.dblValue;
+		delete yymsp[-2].minor.yy78.strValue;
+	}
+}
+#line 1052 "conv_f8tof1_grammar.c"
+        break;
+      case 21: /* condition ::= param_name LESS_EQUAL double_val */
+#line 280 "conv_f8tof1_grammar.y"
+{ 
+	if (!syntaxOnly) {
+		{
+#if PARSER_DEBUG > 0
+			std::cout << "condition ::= param_name LESS_EQUAL double_val." << std::endl;
+#endif
+		}
+		yygotominor.yy78.cond = new Condition();
+		yygotominor.yy78.cond->relation = r_lessEqual;
+		yygotominor.yy78.cond->parameter = *(yymsp[-2].minor.yy78.strValue);
+		yygotominor.yy78.cond->value = yymsp[0].minor.yy78.dblValue;
+		delete yymsp[-2].minor.yy78.strValue;
+	}
+}
+#line 1070 "conv_f8tof1_grammar.c"
+        break;
+      case 22: /* condition ::= param_name NOT_EQUAL double_val */
+#line 294 "conv_f8tof1_grammar.y"
+{ 
+	if (!syntaxOnly) {
+		{
+#if PARSER_DEBUG > 0
+			std::cout << "condition ::= param_name NOT_EQUAL double_val." << std::endl;
+#endif
+		}
+		yygotominor.yy78.cond = new Condition();
+		yygotominor.yy78.cond->relation = r_different;
+		yygotominor.yy78.cond->parameter = *(yymsp[-2].minor.yy78.strValue);
+		yygotominor.yy78.cond->value = yymsp[0].minor.yy78.dblValue;
+		delete yymsp[-2].minor.yy78.strValue;
+	}
+}
+#line 1088 "conv_f8tof1_grammar.c"
+        break;
+      case 23: /* condition ::= param_name EQUAL double_val */
+#line 308 "conv_f8tof1_grammar.y"
+{ 
+	if (!syntaxOnly) {
+		{
+#if PARSER_DEBUG > 0
+			std::cout << "condition ::= param_name EQUAL double_val." << std::endl;
+#endif
+		}
+		yygotominor.yy78.cond = new Condition();
+		yygotominor.yy78.cond->relation = r_equal;
+		yygotominor.yy78.cond->parameter = *(yymsp[-2].minor.yy78.strValue);
+		yygotominor.yy78.cond->value = yymsp[0].minor.yy78.dblValue;
+		delete yymsp[-2].minor.yy78.strValue;
+	}
+}
+#line 1106 "conv_f8tof1_grammar.c"
+        break;
+      case 24: /* condition ::= param_name GREATER_EQUAL double_val */
+#line 322 "conv_f8tof1_grammar.y"
+{ 
+	if (!syntaxOnly) {
+		{
+#if PARSER_DEBUG > 0
+			std::cout << "condition ::= param_name GREATER_EQUAL double_val." << std::endl;
+#endif
+		}
+		yygotominor.yy78.cond = new Condition();
+		yygotominor.yy78.cond->relation = r_greaterEqual;
+		yygotominor.yy78.cond->parameter = *(yymsp[-2].minor.yy78.strValue);
+		yygotominor.yy78.cond->value = yymsp[0].minor.yy78.dblValue;
+		delete yymsp[-2].minor.yy78.strValue;
+	}
+}
+#line 1124 "conv_f8tof1_grammar.c"
+        break;
+      case 25: /* condition ::= param_name GREATER double_val */
+#line 336 "conv_f8tof1_grammar.y"
+{ 
+	if (!syntaxOnly) {
+		{
+#if PARSER_DEBUG > 0
+			std::cout << "condition ::= param_name GREATER double_val." << std::endl;
+#endif
+		}
+		yygotominor.yy78.cond = new Condition();
+		yygotominor.yy78.cond->relation = r_greater;
+		yygotominor.yy78.cond->parameter = *(yymsp[-2].minor.yy78.strValue);
+		yygotominor.yy78.cond->value = yymsp[0].minor.yy78.dblValue;
+		delete yymsp[-2].minor.yy78.strValue;
+	}
+}
+#line 1142 "conv_f8tof1_grammar.c"
+        break;
+      case 26: /* real_prod ::= */
+#line 351 "conv_f8tof1_grammar.y"
+{
+	if (!syntaxOnly) {
+		{
+#if PARSER_DEBUG > 0
+			std::cout << "real_prod ::= ." << std::endl;
+#endif
+		}
+		yygotominor.yy78.vectorActions = new vector<Action*>();
+		yygotominor.yy78.parameters = new vector<vector<SString> >();
+	}
+}
+#line 1157 "conv_f8tof1_grammar.c"
+        break;
+      case 27: /* real_prod ::= prod_piece real_prod */
+#line 362 "conv_f8tof1_grammar.y"
+{
+	if (!syntaxOnly) {
+		{
+#if PARSER_DEBUG > 0
+			std::cout << "real_prod ::= prod_piece real_prod." << std::endl;
+			for (vector<Action*>::iterator actIter = yymsp[-1].minor.yy89.actions->begin(); actIter != yymsp[-1].minor.yy89.actions->end(); actIter++) {
+				cout << "\t" << (*actIter)->name << endl;
+			}
+#endif
+		}
+		//yygotominor.yy78 = yymsp[-1].minor.yy89.clone() && yygotominor.yy78.append(yymsp[0].minor.yy78)
+		yygotominor.yy78.vectorActions = new vector<Action*>(*(yymsp[-1].minor.yy89.actions));
+		yygotominor.yy78.parameters = new vector<vector<SString> >(*(yymsp[-1].minor.yy89.parameters));
+		if (yymsp[0].minor.yy78.vectorActions != NULL && yymsp[0].minor.yy78.parameters != NULL) {
+			for (vector<Action*>::iterator iter = yymsp[0].minor.yy78.vectorActions->begin(); iter != yymsp[0].minor.yy78.vectorActions->end(); iter++) {
+				yygotominor.yy78.vectorActions->push_back(*iter);
+			}
+			for(vector<vector<SString> >::iterator iter = yymsp[0].minor.yy78.parameters->begin(); iter != yymsp[0].minor.yy78.parameters->end(); iter++) {
+				yygotominor.yy78.parameters->push_back(*iter);
+			}
+			delete yymsp[0].minor.yy78.vectorActions;
+			delete yymsp[0].minor.yy78.parameters;
+		} else {
+#if PARSER_DEBUG > 0
+			cout << "\tNULL~~~~~~~~~~~~" << endl;
+#endif
+		}
+		
+		delete yymsp[-1].minor.yy89.actions;
+		delete yymsp[-1].minor.yy89.parameters;
+	}
+}
+#line 1193 "conv_f8tof1_grammar.c"
+        break;
+      case 28: /* real_prod ::= FORLOOP_BEGIN real_prod FORLOOP_END LPAREN single_val RPAREN real_prod */
+#line 394 "conv_f8tof1_grammar.y"
+{
+	if (!syntaxOnly) {
+		{
+#if PARSER_DEBUG > 0
+			std::cout << "real_prod ::= FORLOOP_BEGIN real_prod FORLOOP_END LPAREN single_val RPAREN." << std::endl;
+#endif
+		}
+		yygotominor.yy78.vectorActions = new vector<Action*>();
+		yygotominor.yy78.parameters = new vector<vector<SString> >();
+		int iterations = (int) parseExpression(*(yymsp[-2].minor.yy78.strValue));
+		for (int i = 0; i < iterations; i++) {
+			for (vector<Action*>::iterator iter = yymsp[-5].minor.yy78.vectorActions->begin(); iter != yymsp[-5].minor.yy78.vectorActions->end(); iter++) {
+				yygotominor.yy78.vectorActions->push_back(*iter);
+			}
+			for (vector<vector<SString> >::iterator iter = yymsp[-5].minor.yy78.parameters->begin(); iter != yymsp[-5].minor.yy78.parameters->end(); iter++) {
+				yygotominor.yy78.parameters->push_back(*iter);
+			}
+		}
+		for (vector<Action*>::iterator iter = yymsp[0].minor.yy78.vectorActions->begin(); iter != yymsp[0].minor.yy78.vectorActions->end(); iter++) {
+			yygotominor.yy78.vectorActions->push_back(*iter);
+		}
+		for (vector<vector<SString> >::iterator iter = yymsp[0].minor.yy78.parameters->begin(); iter != yymsp[0].minor.yy78.parameters->end(); iter++) {
+			yygotominor.yy78.parameters->push_back(*iter);
+		}
+		delete yymsp[-5].minor.yy78.vectorActions;
+		delete yymsp[-5].minor.yy78.parameters;
+		delete yymsp[-2].minor.yy78.strValue;
+		delete yymsp[0].minor.yy78.vectorActions;
+		delete yymsp[0].minor.yy78.parameters;
+	}
+}
+#line 1228 "conv_f8tof1_grammar.c"
+        break;
+      case 29: /* prod_piece ::= prod_name LPAREN multiple_val RPAREN */
+#line 426 "conv_f8tof1_grammar.y"
+{
+	if (!syntaxOnly) {
+		{
+#if PARSER_DEBUG > 0
+			std::cout << "prod_piece ::= prod_name LPAREN multiple_val RPAREN." << std::endl;
+#endif
+		}
+		yygotominor.yy89.actions = new vector<Action*>();
+		yygotominor.yy89.parameters = new vector<vector<SString> >();
+		
+		Production *p = lsys->productions.find(sstringToString(*(yymsp[-3].minor.yy78.strValue)))->second;
+		yygotominor.yy89.actions->push_back(p);
+		yygotominor.yy89.parameters->push_back(*(yymsp[-1].minor.yy78.vectorStr));
+		delete yymsp[-3].minor.yy78.strValue;
+		delete yymsp[-1].minor.yy78.vectorStr;
+	}
+}
+#line 1249 "conv_f8tof1_grammar.c"
+        break;
+      case 30: /* prod_piece ::= prod_name LPAREN RPAREN */
+#line 443 "conv_f8tof1_grammar.y"
+{
+	if (!syntaxOnly) {
+		{
+#if PARSER_DEBUG > 0
+			std::cout << "prod_piece ::= prod_name LPAREN RPAREN." << std::endl;
+#endif
+		}
+		yygotominor.yy89.actions = new vector<Action*>();
+		yygotominor.yy89.parameters = new vector<vector<SString> >();
+		
+		Production *p = lsys->productions.find(sstringToString(*(yymsp[-2].minor.yy78.strValue)))->second;
+		yygotominor.yy89.actions->push_back(p);
+		delete yymsp[-2].minor.yy78.strValue;
+	}
+}
+#line 1268 "conv_f8tof1_grammar.c"
+        break;
+      case 31: /* prod_piece ::= command */
+#line 458 "conv_f8tof1_grammar.y"
+{
+	if (!syntaxOnly) {
+		{
+#if PARSER_DEBUG > 0
+			std::cout << "prod_piece ::= command."  << std::endl;
+#endif
+		}
+		yygotominor.yy89.actions = new vector<Action*>();
+		yygotominor.yy89.parameters = new vector<vector<SString> >();
+		PrimitiveProduction *pp = lsys->getPrimitiveProduction(*(yymsp[0].minor.yy78.strValue));
+		yygotominor.yy89.actions->push_back(pp);
+		vector<SString> param;
+		yygotominor.yy89.parameters->push_back(param);
+		delete yymsp[0].minor.yy78.strValue;
+	}
+}
+#line 1288 "conv_f8tof1_grammar.c"
+        break;
+      case 32: /* prod_piece ::= param_name */
+#line 474 "conv_f8tof1_grammar.y"
+{
+	if (!syntaxOnly) {
+		{
+#if PARSER_DEBUG > 0
+			std::cout << "prod_piece ::= paramName." << std::endl;
+#endif
+		}
+		yygotominor.yy89.actions = new vector<Action*>();
+		yygotominor.yy89.parameters = new vector<vector<SString> >();
+		ParamProduction *pp = lsys->getParamProduction(*(yymsp[0].minor.yy78.strValue));
+		yygotominor.yy89.actions->push_back(pp);
+		vector<SString> param;
+		param.push_back(*(yymsp[0].minor.yy78.strValue));
+		yygotominor.yy89.parameters->push_back(param);
+		delete yymsp[0].minor.yy78.strValue;
+	}
+}
+#line 1309 "conv_f8tof1_grammar.c"
+        break;
+      case 33: /* prod_piece ::= neuron */
+#line 491 "conv_f8tof1_grammar.y"
+{
+	if (!syntaxOnly) {
+		{
+#if PARSER_DEBUG > 0
+			std::cout << "prod_piece ::= neuron." << std::endl;
+#endif
+		}
+		yygotominor.yy89.actions = new vector<Action*>();
+		yygotominor.yy89.parameters = new vector<vector<SString> >();
+		NeuronProduction *np = new NeuronProduction(*(yymsp[0].minor.yy78.strValue));
+		lsys->neuronProductions.push_back(np);
+		yygotominor.yy89.actions->push_back(np);
+		vector<SString> param;
+		yygotominor.yy89.parameters->push_back(param);
+		delete yymsp[0].minor.yy78.strValue;		
+	}
+}
+#line 1330 "conv_f8tof1_grammar.c"
+        break;
+      case 34: /* multiple_val ::= single_val */
+#line 509 "conv_f8tof1_grammar.y"
+{
+	if (!syntaxOnly) {
+		{
+#if PARSER_DEBUG > 0
+			std::cout << "multiple_val ::= single_val." << std::endl;
+#endif
+		}
+		yygotominor.yy78.vectorStr = new vector<SString>();
+		yygotominor.yy78.vectorStr->push_back(SString(*(yymsp[0].minor.yy78.strValue)));
+		delete yymsp[0].minor.yy78.strValue;
+	}
+}
+#line 1346 "conv_f8tof1_grammar.c"
+        break;
+      case 35: /* multiple_val ::= multiple_val COMMA multiple_val */
+#line 521 "conv_f8tof1_grammar.y"
+{
+	if (!syntaxOnly) {
+		{
+#if PARSER_DEBUG > 0
+			std::cout << "multiple_val ::= multiple_val COMMA multiple_val." << std::endl;
+#endif
+		}
+		yygotominor.yy78.vectorStr = new vector<SString>();
+		for (vector<SString>::iterator iter = yymsp[-2].minor.yy78.vectorStr->begin(); iter != yymsp[-2].minor.yy78.vectorStr->end(); iter++) {
+			yygotominor.yy78.vectorStr->push_back(*iter);
+		}
+		for (vector<SString>::iterator iter = yymsp[0].minor.yy78.vectorStr->begin(); iter != yymsp[0].minor.yy78.vectorStr->end(); iter++) {
+			yygotominor.yy78.vectorStr->push_back(*iter);
+		}
+		delete yymsp[-2].minor.yy78.vectorStr;
+		delete yymsp[0].minor.yy78.vectorStr;
+	}
+}
+#line 1368 "conv_f8tof1_grammar.c"
+        break;
+      case 36: /* single_val ::= double_val */
+#line 540 "conv_f8tof1_grammar.y"
+{ 
+	if (!syntaxOnly) {
+		{
+#if PARSER_DEBUG > 0
+			std::cout << "single_val ::= double_val." << std::endl;
+#endif
+		}
+		yygotominor.yy78.strValue = new SString(SString::valueOf(yymsp[0].minor.yy78.dblValue) + ";");
+		delete yymsp[0].minor.yy78.strValue;
+	}
+}
+#line 1383 "conv_f8tof1_grammar.c"
+        break;
+      case 37: /* single_val ::= param_name */
+#line 551 "conv_f8tof1_grammar.y"
+{ 
+	if (!syntaxOnly) {
+		{
+#if PARSER_DEBUG > 0
+			std::cout << "single_val ::= param_name." << std::endl;
+#endif
+		}
+		yygotominor.yy78.strValue = new SString(*(yymsp[0].minor.yy78.strValue) + ";");
+		delete yymsp[0].minor.yy78.strValue;
+	}
+}
+#line 1398 "conv_f8tof1_grammar.c"
+        break;
+      case 38: /* single_val ::= single_val PLUS single_val */
+#line 562 "conv_f8tof1_grammar.y"
+{ 
+	if (!syntaxOnly) {
+		{
+#if PARSER_DEBUG > 0
+			std::cout << "single_val ::= single_val PLUS single_val." << std::endl;
+#endif
+		}
+		yygotominor.yy78.strValue = new SString(*(yymsp[-2].minor.yy78.strValue) + *(yymsp[0].minor.yy78.strValue) + "+;");
+		delete yymsp[-2].minor.yy78.strValue;
+		delete yymsp[0].minor.yy78.strValue;
+	}
+}
+#line 1414 "conv_f8tof1_grammar.c"
+        break;
+      case 39: /* single_val ::= single_val MINUS single_val */
+#line 574 "conv_f8tof1_grammar.y"
+{ 
+	if (!syntaxOnly) {
+		{
+#if PARSER_DEBUG > 0
+			std::cout << "single_val ::= single_val MINUS single_val." << std::endl;
+#endif
+		}
+		yygotominor.yy78.strValue = new SString(*(yymsp[-2].minor.yy78.strValue) + *(yymsp[0].minor.yy78.strValue) + "-;");
+		delete yymsp[-2].minor.yy78.strValue;
+		delete yymsp[0].minor.yy78.strValue;
+	}
+}
+#line 1430 "conv_f8tof1_grammar.c"
+        break;
+      case 40: /* single_val ::= single_val TIMES single_val */
+#line 586 "conv_f8tof1_grammar.y"
+{ 
+	if (!syntaxOnly) {
+		{
+#if PARSER_DEBUG > 0
+			std::cout << "single_val ::= single_val TIMES single_val." << std::endl;
+#endif
+		}
+		yygotominor.yy78.strValue = new SString(*(yymsp[-2].minor.yy78.strValue) + *(yymsp[0].minor.yy78.strValue) + "*;");
+		delete yymsp[-2].minor.yy78.strValue;
+		delete yymsp[0].minor.yy78.strValue;
+	}
+}
+#line 1446 "conv_f8tof1_grammar.c"
+        break;
+      case 41: /* single_val ::= single_val DIV single_val */
+#line 598 "conv_f8tof1_grammar.y"
+{ 
+	if (!syntaxOnly) {
+		{
+#if PARSER_DEBUG > 0
+			std::cout << "single_val ::= single_val DIV single_val." << std::endl;
+#endif
+		}
+		yygotominor.yy78.strValue = new SString(*(yymsp[-2].minor.yy78.strValue) + *(yymsp[0].minor.yy78.strValue) + "/;");
+		delete yymsp[-2].minor.yy78.strValue;
+		delete yymsp[0].minor.yy78.strValue;
+	}
+}
+#line 1462 "conv_f8tof1_grammar.c"
+        break;
+      case 42: /* double_val ::= DOUBLE_VAL */
+#line 611 "conv_f8tof1_grammar.y"
+{ 
+	if (!syntaxOnly) {
+		{
+#if PARSER_DEBUG > 0
+			std::cout << "double_val ::= DOUBLE_VAL. -> " << (string(yymsp[0].minor.yy0.strArrValue)).c_str() << std::endl;
+#endif
+		}
+		yygotominor.yy78.dblValue = atof((string(yymsp[0].minor.yy0.strArrValue)).c_str()); 
+	}
+}
+#line 1476 "conv_f8tof1_grammar.c"
+        break;
+      case 43: /* param_name ::= PARAM_NAME */
+#line 621 "conv_f8tof1_grammar.y"
+{ 
+	if (!syntaxOnly) {
+		{
+#if PARSER_DEBUG > 0
+			std::cout << "param_name ::= PARAM_NAME." << std::endl;
+#endif
+		}
+		yygotominor.yy78.strValue = new SString(string(yymsp[0].minor.yy0.strArrValue).c_str());
+	}
+}
+#line 1490 "conv_f8tof1_grammar.c"
+        break;
+      case 44: /* prod_name ::= PROD_NAME */
+#line 631 "conv_f8tof1_grammar.y"
+{ 
+	if (!syntaxOnly) {
+		{
+#if PARSER_DEBUG > 0
+			std::cout << "prod_name ::= PROD_NAME." << std::endl;
+#endif
+		}
+		yygotominor.yy78.strValue = new SString(string(yymsp[0].minor.yy0.strArrValue).c_str());
+	}
+}
+#line 1504 "conv_f8tof1_grammar.c"
+        break;
+      case 45: /* command ::= COMMAND */
+#line 641 "conv_f8tof1_grammar.y"
+{ 
+	if (!syntaxOnly) {
+		{
+#if PARSER_DEBUG > 0
+			std::cout << "command ::= COMMAND." << std::endl;
+#endif
+		}
+		yygotominor.yy78.strValue = new SString(string(yymsp[0].minor.yy0.strArrValue).c_str()); 
+	}
+}
+#line 1518 "conv_f8tof1_grammar.c"
+        break;
+      case 46: /* neuron ::= NEURON */
+#line 651 "conv_f8tof1_grammar.y"
+{ 
+	if (!syntaxOnly) {
+		{
+#if PARSER_DEBUG > 0
+			std::cout << "neuron ::= NEURON." << std::endl;
+#endif
+		}
+		yygotominor.yy78.strValue = new SString(string(yymsp[0].minor.yy0.strArrValue).c_str()); 
+	}
+}
+#line 1532 "conv_f8tof1_grammar.c"
+        break;
+  };
+  yygoto = yyRuleInfo[yyruleno].lhs;
+  yysize = yyRuleInfo[yyruleno].nrhs;
+  yypParser->yyidx -= yysize;
+  yyact = yy_find_reduce_action(yymsp[-yysize].stateno,yygoto);
+  if( yyact < YYNSTATE ){
+#ifdef NDEBUG
+    /* If we are not debugging and the reduce action popped at least
+    ** one element off the stack, then we can push the new element back
+    ** onto the stack here, and skip the stack overflow test in yy_shift().
+    ** That gives a significant speed improvement. */
+    if( yysize ){
+      yypParser->yyidx++;
+      yymsp -= yysize-1;
+      yymsp->stateno = yyact;
+      yymsp->major = yygoto;
+      yymsp->minor = yygotominor;
+    }else
+#endif
+    {
+      yy_shift(yypParser,yyact,yygoto,&yygotominor);
+    }
+  }else{
+    assert( yyact == YYNSTATE + YYNRULE + 1 );
+    yy_accept(yypParser);
+  }
+}
+
+/*
+** The following code executes when the parse fails
+*/
+static void yy_parse_failed(
+  yyParser *yypParser           /* The parser */
+){
+  ParseARG_FETCH;
+#ifndef NDEBUG
+  if( yyTraceFILE ){
+    fprintf(yyTraceFILE,"%sFail!\n",yyTracePrompt);
+  }
+#endif
+  while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser);
+  /* Here code is inserted which will be executed whenever the
+  ** parser fails */
+  ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */
+}
+
+/*
+** The following code executes when a syntax error first occurs.
+*/
+static void yy_syntax_error(
+  yyParser *yypParser,           /* The parser */
+  int yymajor,                   /* The major type of the error token */
+  YYMINORTYPE yyminor            /* The minor type of the error token */
+){
+  ParseARG_FETCH;
+#define TOKEN (yyminor.yy0)
+  ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */
+}
+
+/*
+** The following is executed when the parser accepts
+*/
+static void yy_accept(
+  yyParser *yypParser           /* The parser */
+){
+  ParseARG_FETCH;
+#ifndef NDEBUG
+  if( yyTraceFILE ){
+    fprintf(yyTraceFILE,"%sAccept!\n",yyTracePrompt);
+  }
+#endif
+  while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser);
+  /* Here code is inserted which will be executed whenever the
+  ** parser accepts */
+  ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */
+}
+
+/* The main parser program.
+** The first argument is a pointer to a structure obtained from
+** "ParseAlloc" which describes the current state of the parser.
+** The second argument is the major token number.  The third is
+** the minor token.  The fourth optional argument is whatever the
+** user wants (and specified in the grammar) and is available for
+** use by the action routines.
+**
+** Inputs:
+** <ul>
+** <li> A pointer to the parser (an opaque structure.)
+** <li> The major token number.
+** <li> The minor token number.
+** <li> An option argument of a grammar-specified type.
+** </ul>
+**
+** Outputs:
+** None.
+*/
+void Parse(
+  void *yyp,                   /* The parser */
+  int yymajor,                 /* The major token code number */
+  ParseTOKENTYPE yyminor       /* The value for the token */
+  ParseARG_PDECL               /* Optional %extra_argument parameter */
+){
+  YYMINORTYPE yyminorunion;
+  int yyact;            /* The parser action. */
+  int yyendofinput;     /* True if we are at the end of input */
+#ifdef YYERRORSYMBOL
+  int yyerrorhit = 0;   /* True if yymajor has invoked an error */
+#endif
+  yyParser *yypParser;  /* The parser */
+
+  /* (re)initialize the parser, if necessary */
+  yypParser = (yyParser*)yyp;
+  if( yypParser->yyidx<0 ){
+#if YYSTACKDEPTH<=0
+    if( yypParser->yystksz <=0 ){
+      memset(&yyminorunion, 0, sizeof(yyminorunion));
+      yyStackOverflow(yypParser, &yyminorunion);
+      return;
+    }
+#endif
+    yypParser->yyidx = 0;
+    yypParser->yyerrcnt = -1;
+    yypParser->yystack[0].stateno = 0;
+    yypParser->yystack[0].major = 0;
+  }
+  yyminorunion.yy0 = yyminor;
+  yyendofinput = (yymajor==0);
+  ParseARG_STORE;
+
+#ifndef NDEBUG
+  if( yyTraceFILE ){
+    fprintf(yyTraceFILE,"%sInput %s\n",yyTracePrompt,yyTokenName[yymajor]);
+  }
+#endif
+
+  do{
+    yyact = yy_find_shift_action(yypParser,yymajor);
+    if( yyact<YYNSTATE ){
+      assert( !yyendofinput );  /* Impossible to shift the $ token */
+      yy_shift(yypParser,yyact,yymajor,&yyminorunion);
+      yypParser->yyerrcnt--;
+      yymajor = YYNOCODE;
+    }else if( yyact < YYNSTATE + YYNRULE ){
+      yy_reduce(yypParser,yyact-YYNSTATE);
+    }else{
+      assert( yyact == YY_ERROR_ACTION );
+#ifdef YYERRORSYMBOL
+      int yymx;
+#endif
+#ifndef NDEBUG
+      if( yyTraceFILE ){
+        fprintf(yyTraceFILE,"%sSyntax Error!\n",yyTracePrompt);
+      }
+#endif
+#ifdef YYERRORSYMBOL
+      /* A syntax error has occurred.
+      ** The response to an error depends upon whether or not the
+      ** grammar defines an error token "ERROR".  
+      **
+      ** This is what we do if the grammar does define ERROR:
+      **
+      **  * Call the %syntax_error function.
+      **
+      **  * Begin popping the stack until we enter a state where
+      **    it is legal to shift the error symbol, then shift
+      **    the error symbol.
+      **
+      **  * Set the error count to three.
+      **
+      **  * Begin accepting and shifting new tokens.  No new error
+      **    processing will occur until three tokens have been
+      **    shifted successfully.
+      **
+      */
+      if( yypParser->yyerrcnt<0 ){
+        yy_syntax_error(yypParser,yymajor,yyminorunion);
+      }
+      yymx = yypParser->yystack[yypParser->yyidx].major;
+      if( yymx==YYERRORSYMBOL || yyerrorhit ){
+#ifndef NDEBUG
+        if( yyTraceFILE ){
+          fprintf(yyTraceFILE,"%sDiscard input token %s\n",
+             yyTracePrompt,yyTokenName[yymajor]);
+        }
+#endif
+        yy_destructor(yymajor,&yyminorunion);
+        yymajor = YYNOCODE;
+      }else{
+         while(
+          yypParser->yyidx >= 0 &&
+          yymx != YYERRORSYMBOL &&
+          (yyact = yy_find_reduce_action(
+                        yypParser->yystack[yypParser->yyidx].stateno,
+                        YYERRORSYMBOL)) >= YYNSTATE
+        ){
+          yy_pop_parser_stack(yypParser);
+        }
+        if( yypParser->yyidx < 0 || yymajor==0 ){
+          yy_destructor(yymajor,&yyminorunion);
+          yy_parse_failed(yypParser);
+          yymajor = YYNOCODE;
+        }else if( yymx!=YYERRORSYMBOL ){
+          YYMINORTYPE u2;
+          u2.YYERRSYMDT = 0;
+          yy_shift(yypParser,yyact,YYERRORSYMBOL,&u2);
+        }
+      }
+      yypParser->yyerrcnt = 3;
+      yyerrorhit = 1;
+#else  /* YYERRORSYMBOL is not defined */
+      /* This is what we do if the grammar does not define ERROR:
+      **
+      **  * Report an error message, and throw away the input token.
+      **
+      **  * If the input token is $, then fail the parse.
+      **
+      ** As before, subsequent error messages are suppressed until
+      ** three input tokens have been successfully shifted.
+      */
+      if( yypParser->yyerrcnt<=0 ){
+        yy_syntax_error(yypParser,yymajor,yyminorunion);
+      }
+      yypParser->yyerrcnt = 3;
+      yy_destructor(yymajor,&yyminorunion);
+      if( yyendofinput ){
+        yy_parse_failed(yypParser);
+      }
+      yymajor = YYNOCODE;
+#endif
+    }
+  }while( yymajor!=YYNOCODE && yypParser->yyidx>=0 );
+  return;
+}
+
+
Index: cpp/f8-to-f1/conv_f8tof1_grammar.h
===================================================================
--- cpp/f8-to-f1/conv_f8tof1_grammar.h	(revision 1)
+++ cpp/f8-to-f1/conv_f8tof1_grammar.h	(revision 1)
@@ -0,0 +1,25 @@
+#define COMMA                           1
+#define PLUS                            2
+#define MINUS                           3
+#define DIV                             4
+#define TIMES                           5
+#define NEWLINE                         6
+#define DELIMETER                       7
+#define ASSIGN                          8
+#define SEMICOLON                       9
+#define LPAREN                         10
+#define RPAREN                         11
+#define PIPE                           12
+#define LESS                           13
+#define LESS_EQUAL                     14
+#define NOT_EQUAL                      15
+#define EQUAL                          16
+#define GREATER_EQUAL                  17
+#define GREATER                        18
+#define FORLOOP_BEGIN                  19
+#define FORLOOP_END                    20
+#define DOUBLE_VAL                     21
+#define PARAM_NAME                     22
+#define PROD_NAME                      23
+#define COMMAND                        24
+#define NEURON                         25
Index: cpp/f8-to-f1/conv_f8tof1_scanner.cpp
===================================================================
--- cpp/f8-to-f1/conv_f8tof1_scanner.cpp	(revision 1)
+++ cpp/f8-to-f1/conv_f8tof1_scanner.cpp	(revision 1)
@@ -0,0 +1,1720 @@
+#line 2 "conv_f8tof1_scanner.cpp"
+
+#line 4 "conv_f8tof1_scanner.cpp"
+
+#define  YY_INT_ALIGNED short int
+
+/* A lexical scanner generated by flex */
+
+#define FLEX_SCANNER
+#define YY_FLEX_MAJOR_VERSION 2
+#define YY_FLEX_MINOR_VERSION 5
+#define YY_FLEX_SUBMINOR_VERSION 35
+#if YY_FLEX_SUBMINOR_VERSION > 0
+#define FLEX_BETA
+#endif
+
+    /* The c++ scanner is a mess. The FlexLexer.h header file relies on the
+     * following macro. This is required in order to pass the c++-multiple-scanners
+     * test in the regression suite. We get reports that it breaks inheritance.
+     * We will address this in a future release of flex, or omit the C++ scanner
+     * altogether.
+     */
+    #define yyFlexLexer yyFlexLexer
+
+/* First, we deal with  platform-specific or compiler-specific issues. */
+
+/* begin standard C headers. */
+
+/* end standard C headers. */
+
+/* flex integer type definitions */
+
+#ifndef FLEXINT_H
+#define FLEXINT_H
+
+/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
+
+#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+
+/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
+ * if you want the limit (max/min) macros for int types. 
+ */
+#ifndef __STDC_LIMIT_MACROS
+#define __STDC_LIMIT_MACROS 1
+#endif
+
+#include <inttypes.h>
+typedef int8_t flex_int8_t;
+typedef uint8_t flex_uint8_t;
+typedef int16_t flex_int16_t;
+typedef uint16_t flex_uint16_t;
+typedef int32_t flex_int32_t;
+typedef uint32_t flex_uint32_t;
+#else
+typedef signed char flex_int8_t;
+typedef short int flex_int16_t;
+typedef int flex_int32_t;
+typedef unsigned char flex_uint8_t; 
+typedef unsigned short int flex_uint16_t;
+typedef unsigned int flex_uint32_t;
+
+/* Limits of integral types. */
+#ifndef INT8_MIN
+#define INT8_MIN               (-128)
+#endif
+#ifndef INT16_MIN
+#define INT16_MIN              (-32767-1)
+#endif
+#ifndef INT32_MIN
+#define INT32_MIN              (-2147483647-1)
+#endif
+#ifndef INT8_MAX
+#define INT8_MAX               (127)
+#endif
+#ifndef INT16_MAX
+#define INT16_MAX              (32767)
+#endif
+#ifndef INT32_MAX
+#define INT32_MAX              (2147483647)
+#endif
+#ifndef UINT8_MAX
+#define UINT8_MAX              (255U)
+#endif
+#ifndef UINT16_MAX
+#define UINT16_MAX             (65535U)
+#endif
+#ifndef UINT32_MAX
+#define UINT32_MAX             (4294967295U)
+#endif
+
+#endif /* ! C99 */
+
+#endif /* ! FLEXINT_H */
+
+/* begin standard C++ headers. */
+#include <iostream> 
+#include <errno.h>
+#include <cstdlib>
+#include <cstring>
+/* end standard C++ headers. */
+
+#ifdef __cplusplus
+
+/* The "const" storage-class-modifier is valid. */
+#define YY_USE_CONST
+
+#else	/* ! __cplusplus */
+
+/* C99 requires __STDC__ to be defined as 1. */
+#if defined (__STDC__)
+
+#define YY_USE_CONST
+
+#endif	/* defined (__STDC__) */
+#endif	/* ! __cplusplus */
+
+#ifdef YY_USE_CONST
+#define yyconst const
+#else
+#define yyconst
+#endif
+
+/* Returned upon end-of-file. */
+#define YY_NULL 0
+
+/* Promotes a possibly negative, possibly signed char to an unsigned
+ * integer for use as an array index.  If the signed char is negative,
+ * we want to instead treat it as an 8-bit unsigned char, hence the
+ * double cast.
+ */
+#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
+
+/* Enter a start condition.  This macro really ought to take a parameter,
+ * but we do it the disgusting crufty way forced on us by the ()-less
+ * definition of BEGIN.
+ */
+#define BEGIN (yy_start) = 1 + 2 *
+
+/* Translate the current start state into a value that can be later handed
+ * to BEGIN to return to the state.  The YYSTATE alias is for lex
+ * compatibility.
+ */
+#define YY_START (((yy_start) - 1) / 2)
+#define YYSTATE YY_START
+
+/* Action number for EOF rule of a given start state. */
+#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
+
+/* Special action meaning "start processing a new file". */
+#define YY_NEW_FILE yyrestart( yyin  )
+
+#define YY_END_OF_BUFFER_CHAR 0
+
+/* Size of default input buffer. */
+#ifndef YY_BUF_SIZE
+#define YY_BUF_SIZE 16384
+#endif
+
+/* The state buf must be large enough to hold one state per character in the main buffer.
+ */
+#define YY_STATE_BUF_SIZE   ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
+
+#ifndef YY_TYPEDEF_YY_BUFFER_STATE
+#define YY_TYPEDEF_YY_BUFFER_STATE
+typedef struct yy_buffer_state *YY_BUFFER_STATE;
+#endif
+
+extern int yyleng;
+
+#define EOB_ACT_CONTINUE_SCAN 0
+#define EOB_ACT_END_OF_FILE 1
+#define EOB_ACT_LAST_MATCH 2
+
+    #define YY_LESS_LINENO(n)
+    
+/* Return all but the first "n" matched characters back to the input stream. */
+#define yyless(n) \
+	do \
+		{ \
+		/* Undo effects of setting up yytext. */ \
+        int yyless_macro_arg = (n); \
+        YY_LESS_LINENO(yyless_macro_arg);\
+		*yy_cp = (yy_hold_char); \
+		YY_RESTORE_YY_MORE_OFFSET \
+		(yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
+		YY_DO_BEFORE_ACTION; /* set up yytext again */ \
+		} \
+	while ( 0 )
+
+#define unput(c) yyunput( c, (yytext_ptr)  )
+
+#ifndef YY_TYPEDEF_YY_SIZE_T
+#define YY_TYPEDEF_YY_SIZE_T
+typedef size_t yy_size_t;
+#endif
+
+#ifndef YY_STRUCT_YY_BUFFER_STATE
+#define YY_STRUCT_YY_BUFFER_STATE
+struct yy_buffer_state
+	{
+
+	std::istream* yy_input_file;
+
+	char *yy_ch_buf;		/* input buffer */
+	char *yy_buf_pos;		/* current position in input buffer */
+
+	/* Size of input buffer in bytes, not including room for EOB
+	 * characters.
+	 */
+	yy_size_t yy_buf_size;
+
+	/* Number of characters read into yy_ch_buf, not including EOB
+	 * characters.
+	 */
+	int yy_n_chars;
+
+	/* Whether we "own" the buffer - i.e., we know we created it,
+	 * and can realloc() it to grow it, and should free() it to
+	 * delete it.
+	 */
+	int yy_is_our_buffer;
+
+	/* Whether this is an "interactive" input source; if so, and
+	 * if we're using stdio for input, then we want to use getc()
+	 * instead of fread(), to make sure we stop fetching input after
+	 * each newline.
+	 */
+	int yy_is_interactive;
+
+	/* Whether we're considered to be at the beginning of a line.
+	 * If so, '^' rules will be active on the next match, otherwise
+	 * not.
+	 */
+	int yy_at_bol;
+
+    int yy_bs_lineno; /**< The line count. */
+    int yy_bs_column; /**< The column count. */
+    
+	/* Whether to try to fill the input buffer when we reach the
+	 * end of it.
+	 */
+	int yy_fill_buffer;
+
+	int yy_buffer_status;
+
+#define YY_BUFFER_NEW 0
+#define YY_BUFFER_NORMAL 1
+	/* When an EOF's been seen but there's still some text to process
+	 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
+	 * shouldn't try reading from the input source any more.  We might
+	 * still have a bunch of tokens to match, though, because of
+	 * possible backing-up.
+	 *
+	 * When we actually see the EOF, we change the status to "new"
+	 * (via yyrestart()), so that the user can continue scanning by
+	 * just pointing yyin at a new input file.
+	 */
+#define YY_BUFFER_EOF_PENDING 2
+
+	};
+#endif /* !YY_STRUCT_YY_BUFFER_STATE */
+
+/* We provide macros for accessing buffer states in case in the
+ * future we want to put the buffer states in a more general
+ * "scanner state".
+ *
+ * Returns the top of the stack, or NULL.
+ */
+#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
+                          ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
+                          : NULL)
+
+/* Same as previous macro, but useful when we know that the buffer stack is not
+ * NULL or when we need an lvalue. For internal use only.
+ */
+#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
+
+void *yyalloc (yy_size_t  );
+void *yyrealloc (void *,yy_size_t  );
+void yyfree (void *  );
+
+#define yy_new_buffer yy_create_buffer
+
+#define yy_set_interactive(is_interactive) \
+	{ \
+	if ( ! YY_CURRENT_BUFFER ){ \
+        yyensure_buffer_stack (); \
+		YY_CURRENT_BUFFER_LVALUE =    \
+            yy_create_buffer( yyin, YY_BUF_SIZE ); \
+	} \
+	YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
+	}
+
+#define yy_set_bol(at_bol) \
+	{ \
+	if ( ! YY_CURRENT_BUFFER ){\
+        yyensure_buffer_stack (); \
+		YY_CURRENT_BUFFER_LVALUE =    \
+            yy_create_buffer( yyin, YY_BUF_SIZE ); \
+	} \
+	YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
+	}
+
+#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
+
+/* Begin user sect3 */
+
+typedef unsigned char YY_CHAR;
+
+#define yytext_ptr yytext
+#define YY_INTERACTIVE
+
+#include <FlexLexer.h>
+
+/* Done after the current pattern has been matched and before the
+ * corresponding action - sets up yytext.
+ */
+#define YY_DO_BEFORE_ACTION \
+	(yytext_ptr) = yy_bp; \
+	yyleng = (size_t) (yy_cp - yy_bp); \
+	(yy_hold_char) = *yy_cp; \
+	*yy_cp = '\0'; \
+	(yy_c_buf_p) = yy_cp;
+
+#define YY_NUM_RULES 28
+#define YY_END_OF_BUFFER 29
+/* This struct is not used in this scanner,
+   but its presence is necessary. */
+struct yy_trans_info
+	{
+	flex_int32_t yy_verify;
+	flex_int32_t yy_nxt;
+	};
+static yyconst flex_int16_t yy_accept[44] =
+    {   0,
+        0,    0,   29,   27,    4,   26,   27,   16,   17,   24,
+       22,   21,   23,   25,    3,   19,    6,    5,   11,   12,
+       27,   27,   27,   14,   20,   15,    4,    9,    0,    0,
+        3,    7,    8,   10,    2,    0,    1,   18,    3,    0,
+        0,   13,    0
+    } ;
+
+static yyconst flex_int32_t yy_ec[256] =
+    {   0,
+        1,    1,    1,    1,    1,    1,    1,    1,    2,    3,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    2,    4,    1,    1,    1,    1,    1,    1,    5,
+        6,    7,    8,    9,   10,   11,   12,   13,   13,   13,
+       13,   13,   13,   13,   13,   13,   13,   14,    1,   15,
+       16,   17,    1,    1,   18,    1,   18,    1,   18,   18,
+        1,    1,   18,    1,    1,   18,   18,    1,    1,   19,
+       18,   18,   18,    1,    1,    1,   18,   18,    1,    1,
+       20,   21,   22,   18,    1,    1,   18,    1,   18,    1,
+
+       18,   18,    1,    1,   18,    1,    1,   18,   18,   23,
+        1,    1,   18,   18,   18,    1,    1,    1,   18,    1,
+        1,    1,   24,   25,   26,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1
+    } ;
+
+static yyconst flex_int32_t yy_meta[27] =
+    {   0,
+        1,    1,    2,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1
+    } ;
+
+static yyconst flex_int16_t yy_base[45] =
+    {   0,
+        0,    0,   52,   53,   49,   53,   34,   53,   53,   53,
+       53,   53,   39,   53,   16,   53,   32,   31,   30,   53,
+       32,   24,   30,   53,   53,   53,   40,   53,   31,   27,
+       17,   53,   53,   53,   26,   17,   24,   53,   23,   14,
+       10,   13,   53,   32
+    } ;
+
+static yyconst flex_int16_t yy_def[45] =
+    {   0,
+       43,    1,   43,   43,   43,   43,   43,   43,   43,   43,
+       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,
+       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,
+       43,   43,   43,   43,   43,   44,   43,   43,   43,   44,
+       44,   44,    0,   43
+    } ;
+
+static yyconst flex_int16_t yy_nxt[80] =
+    {   0,
+        4,    5,    6,    7,    8,    9,   10,   11,   12,   13,
+        4,   14,   15,   16,   17,   18,   19,   20,   21,   20,
+       22,   20,   23,   24,   25,   26,   30,   30,   31,   31,
+       41,   42,   40,   41,   41,   39,   37,   41,   35,   39,
+       38,   27,   37,   36,   35,   34,   33,   32,   29,   28,
+       27,   43,    3,   43,   43,   43,   43,   43,   43,   43,
+       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,
+       43,   43,   43,   43,   43,   43,   43,   43,   43
+    } ;
+
+static yyconst flex_int16_t yy_chk[80] =
+    {   0,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,   15,   31,   15,   31,
+       41,   41,   44,   42,   40,   39,   37,   36,   35,   30,
+       29,   27,   23,   22,   21,   19,   18,   17,   13,    7,
+        5,    3,   43,   43,   43,   43,   43,   43,   43,   43,
+       43,   43,   43,   43,   43,   43,   43,   43,   43,   43,
+       43,   43,   43,   43,   43,   43,   43,   43,   43
+    } ;
+
+/* The intent behind this definition is that it'll catch
+ * any uses of REJECT which flex missed.
+ */
+#define REJECT reject_used_but_not_detected
+#define yymore() yymore_used_but_not_detected
+#define YY_MORE_ADJ 0
+#define YY_RESTORE_YY_MORE_OFFSET
+#line 1 "conv_f8tof1_scanner.l"
+/*
+ *  conv_f8tof1_scanner.l
+ *  L-systemToF1
+ *
+ *  Created by Maciej Wajcht on 08-03-28.
+ *  Copyright 2008 __MyCompanyName__. All rights reserved.
+ *
+ */
+#line 10 "conv_f8tof1_scanner.l"
+#include "lexglobal.h"
+#include "conv_f8tof1_grammar.h"
+#include <string.h>
+#include <math.h>
+	
+	YYSTYPE yylval;
+	int line = 1, col = 1;
+	int yyFlexLexer::yywrap(void) {
+	//int yywrap(void) {
+		return 1;
+	}
+#line 453 "conv_f8tof1_scanner.cpp"
+
+#define INITIAL 0
+
+#ifndef YY_NO_UNISTD_H
+/* Special case for "unistd.h", since it is non-ANSI. We include it way
+ * down here because we want the user's section 1 to have been scanned first.
+ * The user has a chance to override it with an option.
+ */
+#include <unistd.h>
+#endif
+
+#ifndef YY_EXTRA_TYPE
+#define YY_EXTRA_TYPE void *
+#endif
+
+#ifndef yytext_ptr
+static void yy_flex_strncpy (char *,yyconst char *,int );
+#endif
+
+#ifdef YY_NEED_STRLEN
+static int yy_flex_strlen (yyconst char * );
+#endif
+
+#ifndef YY_NO_INPUT
+
+#endif
+
+/* Amount of stuff to slurp up with each read. */
+#ifndef YY_READ_BUF_SIZE
+#define YY_READ_BUF_SIZE 8192
+#endif
+
+/* Copy whatever the last rule matched to the standard output. */
+#ifndef ECHO
+#define ECHO LexerOutput( yytext, yyleng )
+#endif
+
+/* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
+ * is returned in "result".
+ */
+#ifndef YY_INPUT
+#define YY_INPUT(buf,result,max_size) \
+\
+	if ( (result = LexerInput( (char *) buf, max_size )) < 0 ) \
+		YY_FATAL_ERROR( "input in flex scanner failed" );
+
+#endif
+
+/* No semi-colon after return; correct usage is to write "yyterminate();" -
+ * we don't want an extra ';' after the "return" because that will cause
+ * some compilers to complain about unreachable statements.
+ */
+#ifndef yyterminate
+#define yyterminate() return YY_NULL
+#endif
+
+/* Number of entries by which start-condition stack grows. */
+#ifndef YY_START_STACK_INCR
+#define YY_START_STACK_INCR 25
+#endif
+
+/* Report a fatal error. */
+#ifndef YY_FATAL_ERROR
+#define YY_FATAL_ERROR(msg) LexerError( msg )
+#endif
+
+/* end tables serialization structures and prototypes */
+
+/* Default declaration of generated scanner - a define so the user can
+ * easily add parameters.
+ */
+#ifndef YY_DECL
+#define YY_DECL_IS_OURS 1
+#define YY_DECL int yyFlexLexer::yylex()
+#endif /* !YY_DECL */
+
+/* Code executed at the beginning of each rule, after yytext and yyleng
+ * have been set up.
+ */
+#ifndef YY_USER_ACTION
+#define YY_USER_ACTION
+#endif
+
+/* Code executed at the end of each rule. */
+#ifndef YY_BREAK
+#define YY_BREAK break;
+#endif
+
+#define YY_RULE_SETUP \
+	YY_USER_ACTION
+
+/** The main scanner function which does all the work.
+ */
+YY_DECL
+{
+	register yy_state_type yy_current_state;
+	register char *yy_cp, *yy_bp;
+	register int yy_act;
+    
+#line 22 "conv_f8tof1_scanner.l"
+
+
+#line 556 "conv_f8tof1_scanner.cpp"
+
+	if ( !(yy_init) )
+		{
+		(yy_init) = 1;
+
+#ifdef YY_USER_INIT
+		YY_USER_INIT;
+#endif
+
+		if ( ! (yy_start) )
+			(yy_start) = 1;	/* first start state */
+
+		if ( ! yyin )
+			yyin = & std::cin;
+
+		if ( ! yyout )
+			yyout = & std::cout;
+
+		if ( ! YY_CURRENT_BUFFER ) {
+			yyensure_buffer_stack ();
+			YY_CURRENT_BUFFER_LVALUE =
+				yy_create_buffer( yyin, YY_BUF_SIZE );
+		}
+
+		yy_load_buffer_state(  );
+		}
+
+	while ( 1 )		/* loops until end-of-file is reached */
+		{
+		yy_cp = (yy_c_buf_p);
+
+		/* Support of yytext. */
+		*yy_cp = (yy_hold_char);
+
+		/* yy_bp points to the position in yy_ch_buf of the start of
+		 * the current run.
+		 */
+		yy_bp = yy_cp;
+
+		yy_current_state = (yy_start);
+yy_match:
+		do
+			{
+			register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
+			if ( yy_accept[yy_current_state] )
+				{
+				(yy_last_accepting_state) = yy_current_state;
+				(yy_last_accepting_cpos) = yy_cp;
+				}
+			while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
+				{
+				yy_current_state = (int) yy_def[yy_current_state];
+				if ( yy_current_state >= 44 )
+					yy_c = yy_meta[(unsigned int) yy_c];
+				}
+			yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+			++yy_cp;
+			}
+		while ( yy_base[yy_current_state] != 53 );
+
+yy_find_action:
+		yy_act = yy_accept[yy_current_state];
+		if ( yy_act == 0 )
+			{ /* have to back up */
+			yy_cp = (yy_last_accepting_cpos);
+			yy_current_state = (yy_last_accepting_state);
+			yy_act = yy_accept[yy_current_state];
+			}
+
+		YY_DO_BEFORE_ACTION;
+
+do_action:	/* This label is used only to access EOF actions. */
+
+		switch ( yy_act )
+	{ /* beginning of action switch */
+			case 0: /* must back up */
+			/* undo the effects of YY_DO_BEFORE_ACTION */
+			*yy_cp = (yy_hold_char);
+			yy_cp = (yy_last_accepting_cpos);
+			yy_current_state = (yy_last_accepting_state);
+			goto yy_find_action;
+
+case 1:
+YY_RULE_SETUP
+#line 24 "conv_f8tof1_scanner.l"
+{ col += yyleng; 
+					  yylval.strVal = yytext;
+					  return PARAM_NAME; 
+					}
+	YY_BREAK
+case 2:
+YY_RULE_SETUP
+#line 29 "conv_f8tof1_scanner.l"
+{ col += yyleng; 
+					  yylval.strVal = yytext;
+					  return PROD_NAME; 
+					}
+	YY_BREAK
+case 3:
+YY_RULE_SETUP
+#line 34 "conv_f8tof1_scanner.l"
+{ col += yyleng;
+					  //yylval.dblVal = atof(yytext);
+					  yylval.strVal = yytext;
+					  return DOUBLE_VAL; 
+					}
+	YY_BREAK
+case 4:
+YY_RULE_SETUP
+#line 40 "conv_f8tof1_scanner.l"
+{ col += yyleng; }               /* ignore but count white space */
+	YY_BREAK
+case 5:
+YY_RULE_SETUP
+#line 42 "conv_f8tof1_scanner.l"
+{ col += yyleng; yylval.strVal = yytext; return ASSIGN; }
+	YY_BREAK
+case 6:
+YY_RULE_SETUP
+#line 44 "conv_f8tof1_scanner.l"
+{ col += yyleng; yylval.strVal = yytext; return LESS; }
+	YY_BREAK
+case 7:
+YY_RULE_SETUP
+#line 45 "conv_f8tof1_scanner.l"
+{ col += yyleng; yylval.strVal = yytext; return LESS_EQUAL; }
+	YY_BREAK
+case 8:
+YY_RULE_SETUP
+#line 46 "conv_f8tof1_scanner.l"
+{ col += yyleng; yylval.strVal = yytext; return EQUAL; }
+	YY_BREAK
+case 9:
+YY_RULE_SETUP
+#line 47 "conv_f8tof1_scanner.l"
+{ col += yyleng; yylval.strVal = yytext; return NOT_EQUAL; }
+	YY_BREAK
+case 10:
+YY_RULE_SETUP
+#line 48 "conv_f8tof1_scanner.l"
+{ col += yyleng; yylval.strVal = yytext; return GREATER_EQUAL; }
+	YY_BREAK
+case 11:
+YY_RULE_SETUP
+#line 49 "conv_f8tof1_scanner.l"
+{ col += yyleng; yylval.strVal = yytext; return GREATER; }
+	YY_BREAK
+case 12:
+YY_RULE_SETUP
+#line 51 "conv_f8tof1_scanner.l"
+{ col += yyleng; 
+					  yylval.strVal = yytext;
+					  return COMMAND; 
+					}
+	YY_BREAK
+case 13:
+YY_RULE_SETUP
+#line 56 "conv_f8tof1_scanner.l"
+{ col += yyleng;
+					  yylval.strVal = yytext;
+					  return NEURON;
+					}
+	YY_BREAK
+case 14:
+YY_RULE_SETUP
+#line 61 "conv_f8tof1_scanner.l"
+{ col += yyleng; yylval.strVal = yytext; return FORLOOP_BEGIN; }
+	YY_BREAK
+case 15:
+YY_RULE_SETUP
+#line 62 "conv_f8tof1_scanner.l"
+{ col += yyleng; yylval.strVal = yytext; return FORLOOP_END; }
+	YY_BREAK
+case 16:
+YY_RULE_SETUP
+#line 64 "conv_f8tof1_scanner.l"
+{ col += yyleng; yylval.strVal = yytext; return LPAREN; }
+	YY_BREAK
+case 17:
+YY_RULE_SETUP
+#line 65 "conv_f8tof1_scanner.l"
+{ col += yyleng; yylval.strVal = yytext; return RPAREN; }
+	YY_BREAK
+case 18:
+YY_RULE_SETUP
+#line 67 "conv_f8tof1_scanner.l"
+{ col += yyleng; yylval.strVal = yytext; return DELIMETER; }
+	YY_BREAK
+case 19:
+YY_RULE_SETUP
+#line 69 "conv_f8tof1_scanner.l"
+{ col += yyleng; yylval.strVal = yytext; return SEMICOLON; }
+	YY_BREAK
+case 20:
+YY_RULE_SETUP
+#line 70 "conv_f8tof1_scanner.l"
+{ col += yyleng; yylval.strVal = yytext; return PIPE; }
+	YY_BREAK
+case 21:
+YY_RULE_SETUP
+#line 71 "conv_f8tof1_scanner.l"
+{ col += yyleng; yylval.strVal = yytext; return COMMA; }
+	YY_BREAK
+case 22:
+YY_RULE_SETUP
+#line 73 "conv_f8tof1_scanner.l"
+{ col += yyleng; yylval.strVal = yytext; return PLUS; }
+	YY_BREAK
+case 23:
+YY_RULE_SETUP
+#line 74 "conv_f8tof1_scanner.l"
+{ col += yyleng; yylval.strVal = yytext; return MINUS; }
+	YY_BREAK
+case 24:
+YY_RULE_SETUP
+#line 75 "conv_f8tof1_scanner.l"
+{ col += yyleng; yylval.strVal = yytext; return TIMES; }
+	YY_BREAK
+case 25:
+YY_RULE_SETUP
+#line 76 "conv_f8tof1_scanner.l"
+{ col += yyleng; yylval.strVal = yytext; return DIV; }
+	YY_BREAK
+case 26:
+/* rule 26 can match eol */
+YY_RULE_SETUP
+#line 78 "conv_f8tof1_scanner.l"
+{ col = 0; ++line; yylval.strVal = "\\n"; return NEWLINE; }
+	YY_BREAK
+case 27:
+YY_RULE_SETUP
+#line 80 "conv_f8tof1_scanner.l"
+{ col += yyleng; yylval.strVal = yytext; return -1; }
+	YY_BREAK
+case 28:
+YY_RULE_SETUP
+#line 82 "conv_f8tof1_scanner.l"
+ECHO;
+	YY_BREAK
+#line 796 "conv_f8tof1_scanner.cpp"
+case YY_STATE_EOF(INITIAL):
+	yyterminate();
+
+	case YY_END_OF_BUFFER:
+		{
+		/* Amount of text matched not including the EOB char. */
+		int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
+
+		/* Undo the effects of YY_DO_BEFORE_ACTION. */
+		*yy_cp = (yy_hold_char);
+		YY_RESTORE_YY_MORE_OFFSET
+
+		if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
+			{
+			/* We're scanning a new file or input source.  It's
+			 * possible that this happened because the user
+			 * just pointed yyin at a new source and called
+			 * yylex().  If so, then we have to assure
+			 * consistency between YY_CURRENT_BUFFER and our
+			 * globals.  Here is the right place to do so, because
+			 * this is the first action (other than possibly a
+			 * back-up) that will match for the new input source.
+			 */
+			(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
+			YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
+			YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
+			}
+
+		/* Note that here we test for yy_c_buf_p "<=" to the position
+		 * of the first EOB in the buffer, since yy_c_buf_p will
+		 * already have been incremented past the NUL character
+		 * (since all states make transitions on EOB to the
+		 * end-of-buffer state).  Contrast this with the test
+		 * in input().
+		 */
+		if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
+			{ /* This was really a NUL. */
+			yy_state_type yy_next_state;
+
+			(yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
+
+			yy_current_state = yy_get_previous_state(  );
+
+			/* Okay, we're now positioned to make the NUL
+			 * transition.  We couldn't have
+			 * yy_get_previous_state() go ahead and do it
+			 * for us because it doesn't know how to deal
+			 * with the possibility of jamming (and we don't
+			 * want to build jamming into it because then it
+			 * will run more slowly).
+			 */
+
+			yy_next_state = yy_try_NUL_trans( yy_current_state );
+
+			yy_bp = (yytext_ptr) + YY_MORE_ADJ;
+
+			if ( yy_next_state )
+				{
+				/* Consume the NUL. */
+				yy_cp = ++(yy_c_buf_p);
+				yy_current_state = yy_next_state;
+				goto yy_match;
+				}
+
+			else
+				{
+				yy_cp = (yy_c_buf_p);
+				goto yy_find_action;
+				}
+			}
+
+		else switch ( yy_get_next_buffer(  ) )
+			{
+			case EOB_ACT_END_OF_FILE:
+				{
+				(yy_did_buffer_switch_on_eof) = 0;
+
+				if ( yywrap(  ) )
+					{
+					/* Note: because we've taken care in
+					 * yy_get_next_buffer() to have set up
+					 * yytext, we can now set up
+					 * yy_c_buf_p so that if some total
+					 * hoser (like flex itself) wants to
+					 * call the scanner after we return the
+					 * YY_NULL, it'll still work - another
+					 * YY_NULL will get returned.
+					 */
+					(yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
+
+					yy_act = YY_STATE_EOF(YY_START);
+					goto do_action;
+					}
+
+				else
+					{
+					if ( ! (yy_did_buffer_switch_on_eof) )
+						YY_NEW_FILE;
+					}
+				break;
+				}
+
+			case EOB_ACT_CONTINUE_SCAN:
+				(yy_c_buf_p) =
+					(yytext_ptr) + yy_amount_of_matched_text;
+
+				yy_current_state = yy_get_previous_state(  );
+
+				yy_cp = (yy_c_buf_p);
+				yy_bp = (yytext_ptr) + YY_MORE_ADJ;
+				goto yy_match;
+
+			case EOB_ACT_LAST_MATCH:
+				(yy_c_buf_p) =
+				&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
+
+				yy_current_state = yy_get_previous_state(  );
+
+				yy_cp = (yy_c_buf_p);
+				yy_bp = (yytext_ptr) + YY_MORE_ADJ;
+				goto yy_find_action;
+			}
+		break;
+		}
+
+	default:
+		YY_FATAL_ERROR(
+			"fatal flex scanner internal error--no action found" );
+	} /* end of action switch */
+		} /* end of scanning one token */
+} /* end of yylex */
+
+/* The contents of this function are C++ specific, so the () macro is not used.
+ */
+yyFlexLexer::yyFlexLexer( std::istream* arg_yyin, std::ostream* arg_yyout )
+{
+	yyin = arg_yyin;
+	yyout = arg_yyout;
+	yy_c_buf_p = 0;
+	yy_init = 0;
+	yy_start = 0;
+	yy_flex_debug = 0;
+	yylineno = 1;	// this will only get updated if %option yylineno
+
+	yy_did_buffer_switch_on_eof = 0;
+
+	yy_looking_for_trail_begin = 0;
+	yy_more_flag = 0;
+	yy_more_len = 0;
+	yy_more_offset = yy_prev_more_offset = 0;
+
+	yy_start_stack_ptr = yy_start_stack_depth = 0;
+	yy_start_stack = NULL;
+
+	yy_buffer_stack = 0;
+	yy_buffer_stack_top = 0;
+	yy_buffer_stack_max = 0;
+
+	yy_state_buf = 0;
+
+}
+
+/* The contents of this function are C++ specific, so the () macro is not used.
+ */
+yyFlexLexer::~yyFlexLexer()
+{
+	delete [] yy_state_buf;
+	yyfree(yy_start_stack  );
+	yy_delete_buffer( YY_CURRENT_BUFFER );
+	yyfree(yy_buffer_stack  );
+}
+
+/* The contents of this function are C++ specific, so the () macro is not used.
+ */
+void yyFlexLexer::switch_streams( std::istream* new_in, std::ostream* new_out )
+{
+	if ( new_in )
+		{
+		yy_delete_buffer( YY_CURRENT_BUFFER );
+		yy_switch_to_buffer( yy_create_buffer( new_in, YY_BUF_SIZE  ) );
+		}
+
+	if ( new_out )
+		yyout = new_out;
+}
+
+#ifdef YY_INTERACTIVE
+int yyFlexLexer::LexerInput( char* buf, int /* max_size */ )
+#else
+int yyFlexLexer::LexerInput( char* buf, int max_size )
+#endif
+{
+	if ( yyin->eof() || yyin->fail() )
+		return 0;
+
+#ifdef YY_INTERACTIVE
+	yyin->get( buf[0] );
+
+	if ( yyin->eof() )
+		return 0;
+
+	if ( yyin->bad() )
+		return -1;
+
+	return 1;
+
+#else
+	(void) yyin->read( buf, max_size );
+
+	if ( yyin->bad() )
+		return -1;
+	else
+		return yyin->gcount();
+#endif
+}
+
+void yyFlexLexer::LexerOutput( const char* buf, int size )
+{
+	(void) yyout->write( buf, size );
+}
+
+/* yy_get_next_buffer - try to read in a new buffer
+ *
+ * Returns a code representing an action:
+ *	EOB_ACT_LAST_MATCH -
+ *	EOB_ACT_CONTINUE_SCAN - continue scanning from current position
+ *	EOB_ACT_END_OF_FILE - end of file
+ */
+int yyFlexLexer::yy_get_next_buffer()
+{
+    	register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
+	register char *source = (yytext_ptr);
+	register int number_to_move, i;
+	int ret_val;
+
+	if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
+		YY_FATAL_ERROR(
+		"fatal flex scanner internal error--end of buffer missed" );
+
+	if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
+		{ /* Don't try to fill the buffer, so this is an EOF. */
+		if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
+			{
+			/* We matched a single character, the EOB, so
+			 * treat this as a final EOF.
+			 */
+			return EOB_ACT_END_OF_FILE;
+			}
+
+		else
+			{
+			/* We matched some text prior to the EOB, first
+			 * process it.
+			 */
+			return EOB_ACT_LAST_MATCH;
+			}
+		}
+
+	/* Try to read more data. */
+
+	/* First move last chars to start of buffer. */
+	number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
+
+	for ( i = 0; i < number_to_move; ++i )
+		*(dest++) = *(source++);
+
+	if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
+		/* don't do the read, it's not guaranteed to return an EOF,
+		 * just force an EOF
+		 */
+		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
+
+	else
+		{
+			int num_to_read =
+			YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
+
+		while ( num_to_read <= 0 )
+			{ /* Not enough room in the buffer - grow it. */
+
+			/* just a shorter name for the current buffer */
+			YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
+
+			int yy_c_buf_p_offset =
+				(int) ((yy_c_buf_p) - b->yy_ch_buf);
+
+			if ( b->yy_is_our_buffer )
+				{
+				int new_size = b->yy_buf_size * 2;
+
+				if ( new_size <= 0 )
+					b->yy_buf_size += b->yy_buf_size / 8;
+				else
+					b->yy_buf_size *= 2;
+
+				b->yy_ch_buf = (char *)
+					/* Include room in for 2 EOB chars. */
+					yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2  );
+				}
+			else
+				/* Can't grow it, we don't own it. */
+				b->yy_ch_buf = 0;
+
+			if ( ! b->yy_ch_buf )
+				YY_FATAL_ERROR(
+				"fatal error - scanner input buffer overflow" );
+
+			(yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
+
+			num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
+						number_to_move - 1;
+
+			}
+
+		if ( num_to_read > YY_READ_BUF_SIZE )
+			num_to_read = YY_READ_BUF_SIZE;
+
+		/* Read in more data. */
+		YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
+			(yy_n_chars), (size_t) num_to_read );
+
+		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
+		}
+
+	if ( (yy_n_chars) == 0 )
+		{
+		if ( number_to_move == YY_MORE_ADJ )
+			{
+			ret_val = EOB_ACT_END_OF_FILE;
+			yyrestart( yyin  );
+			}
+
+		else
+			{
+			ret_val = EOB_ACT_LAST_MATCH;
+			YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
+				YY_BUFFER_EOF_PENDING;
+			}
+		}
+
+	else
+		ret_val = EOB_ACT_CONTINUE_SCAN;
+
+	if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
+		/* Extend the array by 50%, plus the number we really need. */
+		yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
+		YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size  );
+		if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
+			YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
+	}
+
+	(yy_n_chars) += number_to_move;
+	YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
+	YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
+
+	(yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
+
+	return ret_val;
+}
+
+/* yy_get_previous_state - get the state just before the EOB char was reached */
+
+    yy_state_type yyFlexLexer::yy_get_previous_state()
+{
+	register yy_state_type yy_current_state;
+	register char *yy_cp;
+    
+	yy_current_state = (yy_start);
+
+	for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
+		{
+		register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
+		if ( yy_accept[yy_current_state] )
+			{
+			(yy_last_accepting_state) = yy_current_state;
+			(yy_last_accepting_cpos) = yy_cp;
+			}
+		while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
+			{
+			yy_current_state = (int) yy_def[yy_current_state];
+			if ( yy_current_state >= 44 )
+				yy_c = yy_meta[(unsigned int) yy_c];
+			}
+		yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+		}
+
+	return yy_current_state;
+}
+
+/* yy_try_NUL_trans - try to make a transition on the NUL character
+ *
+ * synopsis
+ *	next_state = yy_try_NUL_trans( current_state );
+ */
+    yy_state_type yyFlexLexer::yy_try_NUL_trans( yy_state_type yy_current_state )
+{
+	register int yy_is_jam;
+    	register char *yy_cp = (yy_c_buf_p);
+
+	register YY_CHAR yy_c = 1;
+	if ( yy_accept[yy_current_state] )
+		{
+		(yy_last_accepting_state) = yy_current_state;
+		(yy_last_accepting_cpos) = yy_cp;
+		}
+	while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
+		{
+		yy_current_state = (int) yy_def[yy_current_state];
+		if ( yy_current_state >= 44 )
+			yy_c = yy_meta[(unsigned int) yy_c];
+		}
+	yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+	yy_is_jam = (yy_current_state == 43);
+
+	return yy_is_jam ? 0 : yy_current_state;
+}
+
+    void yyFlexLexer::yyunput( int c, register char* yy_bp)
+{
+	register char *yy_cp;
+    
+    yy_cp = (yy_c_buf_p);
+
+	/* undo effects of setting up yytext */
+	*yy_cp = (yy_hold_char);
+
+	if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
+		{ /* need to shift things up to make room */
+		/* +2 for EOB chars. */
+		register int number_to_move = (yy_n_chars) + 2;
+		register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
+					YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
+		register char *source =
+				&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
+
+		while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
+			*--dest = *--source;
+
+		yy_cp += (int) (dest - source);
+		yy_bp += (int) (dest - source);
+		YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
+			(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
+
+		if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
+			YY_FATAL_ERROR( "flex scanner push-back overflow" );
+		}
+
+	*--yy_cp = (char) c;
+
+	(yytext_ptr) = yy_bp;
+	(yy_hold_char) = *yy_cp;
+	(yy_c_buf_p) = yy_cp;
+}
+
+    int yyFlexLexer::yyinput()
+{
+	int c;
+    
+	*(yy_c_buf_p) = (yy_hold_char);
+
+	if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
+		{
+		/* yy_c_buf_p now points to the character we want to return.
+		 * If this occurs *before* the EOB characters, then it's a
+		 * valid NUL; if not, then we've hit the end of the buffer.
+		 */
+		if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
+			/* This was really a NUL. */
+			*(yy_c_buf_p) = '\0';
+
+		else
+			{ /* need more input */
+			int offset = (yy_c_buf_p) - (yytext_ptr);
+			++(yy_c_buf_p);
+
+			switch ( yy_get_next_buffer(  ) )
+				{
+				case EOB_ACT_LAST_MATCH:
+					/* This happens because yy_g_n_b()
+					 * sees that we've accumulated a
+					 * token and flags that we need to
+					 * try matching the token before
+					 * proceeding.  But for input(),
+					 * there's no matching to consider.
+					 * So convert the EOB_ACT_LAST_MATCH
+					 * to EOB_ACT_END_OF_FILE.
+					 */
+
+					/* Reset buffer status. */
+					yyrestart( yyin );
+
+					/*FALLTHROUGH*/
+
+				case EOB_ACT_END_OF_FILE:
+					{
+					if ( yywrap(  ) )
+						return EOF;
+
+					if ( ! (yy_did_buffer_switch_on_eof) )
+						YY_NEW_FILE;
+#ifdef __cplusplus
+					return yyinput();
+#else
+					return input();
+#endif
+					}
+
+				case EOB_ACT_CONTINUE_SCAN:
+					(yy_c_buf_p) = (yytext_ptr) + offset;
+					break;
+				}
+			}
+		}
+
+	c = *(unsigned char *) (yy_c_buf_p);	/* cast for 8-bit char's */
+	*(yy_c_buf_p) = '\0';	/* preserve yytext */
+	(yy_hold_char) = *++(yy_c_buf_p);
+
+	return c;
+}
+
+/** Immediately switch to a different input stream.
+ * @param input_file A readable stream.
+ * 
+ * @note This function does not reset the start condition to @c INITIAL .
+ */
+    void yyFlexLexer::yyrestart( std::istream* input_file )
+{
+    
+	if ( ! YY_CURRENT_BUFFER ){
+        yyensure_buffer_stack ();
+		YY_CURRENT_BUFFER_LVALUE =
+            yy_create_buffer( yyin, YY_BUF_SIZE );
+	}
+
+	yy_init_buffer( YY_CURRENT_BUFFER, input_file );
+	yy_load_buffer_state(  );
+}
+
+/** Switch to a different input buffer.
+ * @param new_buffer The new input buffer.
+ * 
+ */
+    void yyFlexLexer::yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
+{
+    
+	/* TODO. We should be able to replace this entire function body
+	 * with
+	 *		yypop_buffer_state();
+	 *		yypush_buffer_state(new_buffer);
+     */
+	yyensure_buffer_stack ();
+	if ( YY_CURRENT_BUFFER == new_buffer )
+		return;
+
+	if ( YY_CURRENT_BUFFER )
+		{
+		/* Flush out information for old buffer. */
+		*(yy_c_buf_p) = (yy_hold_char);
+		YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
+		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
+		}
+
+	YY_CURRENT_BUFFER_LVALUE = new_buffer;
+	yy_load_buffer_state(  );
+
+	/* We don't actually know whether we did this switch during
+	 * EOF (yywrap()) processing, but the only time this flag
+	 * is looked at is after yywrap() is called, so it's safe
+	 * to go ahead and always set it.
+	 */
+	(yy_did_buffer_switch_on_eof) = 1;
+}
+
+    void yyFlexLexer::yy_load_buffer_state()
+{
+    	(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
+	(yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
+	yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
+	(yy_hold_char) = *(yy_c_buf_p);
+}
+
+/** Allocate and initialize an input buffer state.
+ * @param file A readable stream.
+ * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
+ * 
+ * @return the allocated buffer state.
+ */
+    YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( std::istream* file, int size )
+{
+	YY_BUFFER_STATE b;
+    
+	b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state )  );
+	if ( ! b )
+		YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
+
+	b->yy_buf_size = size;
+
+	/* yy_ch_buf has to be 2 characters longer than the size given because
+	 * we need to put in 2 end-of-buffer characters.
+	 */
+	b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2  );
+	if ( ! b->yy_ch_buf )
+		YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
+
+	b->yy_is_our_buffer = 1;
+
+	yy_init_buffer( b, file );
+
+	return b;
+}
+
+/** Destroy the buffer.
+ * @param b a buffer created with yy_create_buffer()
+ * 
+ */
+    void yyFlexLexer::yy_delete_buffer( YY_BUFFER_STATE b )
+{
+    
+	if ( ! b )
+		return;
+
+	if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
+		YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
+
+	if ( b->yy_is_our_buffer )
+		yyfree((void *) b->yy_ch_buf  );
+
+	yyfree((void *) b  );
+}
+
+extern "C" int isatty (int );
+
+/* Initializes or reinitializes a buffer.
+ * This function is sometimes called more than once on the same buffer,
+ * such as during a yyrestart() or at EOF.
+ */
+    void yyFlexLexer::yy_init_buffer( YY_BUFFER_STATE b, std::istream* file )
+
+{
+	int oerrno = errno;
+    
+	yy_flush_buffer( b );
+
+	b->yy_input_file = file;
+	b->yy_fill_buffer = 1;
+
+    /* If b is the current buffer, then yy_init_buffer was _probably_
+     * called from yyrestart() or through yy_get_next_buffer.
+     * In that case, we don't want to reset the lineno or column.
+     */
+    if (b != YY_CURRENT_BUFFER){
+        b->yy_bs_lineno = 1;
+        b->yy_bs_column = 0;
+    }
+
+	b->yy_is_interactive = 0;
+	errno = oerrno;
+}
+
+/** Discard all buffered characters. On the next scan, YY_INPUT will be called.
+ * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
+ * 
+ */
+    void yyFlexLexer::yy_flush_buffer( YY_BUFFER_STATE b )
+{
+    	if ( ! b )
+		return;
+
+	b->yy_n_chars = 0;
+
+	/* We always need two end-of-buffer characters.  The first causes
+	 * a transition to the end-of-buffer state.  The second causes
+	 * a jam in that state.
+	 */
+	b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
+	b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
+
+	b->yy_buf_pos = &b->yy_ch_buf[0];
+
+	b->yy_at_bol = 1;
+	b->yy_buffer_status = YY_BUFFER_NEW;
+
+	if ( b == YY_CURRENT_BUFFER )
+		yy_load_buffer_state(  );
+}
+
+/** Pushes the new state onto the stack. The new state becomes
+ *  the current state. This function will allocate the stack
+ *  if necessary.
+ *  @param new_buffer The new state.
+ *  
+ */
+void yyFlexLexer::yypush_buffer_state (YY_BUFFER_STATE new_buffer)
+{
+    	if (new_buffer == NULL)
+		return;
+
+	yyensure_buffer_stack();
+
+	/* This block is copied from yy_switch_to_buffer. */
+	if ( YY_CURRENT_BUFFER )
+		{
+		/* Flush out information for old buffer. */
+		*(yy_c_buf_p) = (yy_hold_char);
+		YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
+		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
+		}
+
+	/* Only push if top exists. Otherwise, replace top. */
+	if (YY_CURRENT_BUFFER)
+		(yy_buffer_stack_top)++;
+	YY_CURRENT_BUFFER_LVALUE = new_buffer;
+
+	/* copied from yy_switch_to_buffer. */
+	yy_load_buffer_state(  );
+	(yy_did_buffer_switch_on_eof) = 1;
+}
+
+/** Removes and deletes the top of the stack, if present.
+ *  The next element becomes the new top.
+ *  
+ */
+void yyFlexLexer::yypop_buffer_state (void)
+{
+    	if (!YY_CURRENT_BUFFER)
+		return;
+
+	yy_delete_buffer(YY_CURRENT_BUFFER );
+	YY_CURRENT_BUFFER_LVALUE = NULL;
+	if ((yy_buffer_stack_top) > 0)
+		--(yy_buffer_stack_top);
+
+	if (YY_CURRENT_BUFFER) {
+		yy_load_buffer_state(  );
+		(yy_did_buffer_switch_on_eof) = 1;
+	}
+}
+
+/* Allocates the stack if it does not exist.
+ *  Guarantees space for at least one push.
+ */
+void yyFlexLexer::yyensure_buffer_stack(void)
+{
+	int num_to_alloc;
+    
+	if (!(yy_buffer_stack)) {
+
+		/* First allocation is just for 2 elements, since we don't know if this
+		 * scanner will even need a stack. We use 2 instead of 1 to avoid an
+		 * immediate realloc on the next call.
+         */
+		num_to_alloc = 1;
+		(yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
+								(num_to_alloc * sizeof(struct yy_buffer_state*)
+								);
+		if ( ! (yy_buffer_stack) )
+			YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
+								  
+		memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
+				
+		(yy_buffer_stack_max) = num_to_alloc;
+		(yy_buffer_stack_top) = 0;
+		return;
+	}
+
+	if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
+
+		/* Increase the buffer to prepare for a possible push. */
+		int grow_size = 8 /* arbitrary grow size */;
+
+		num_to_alloc = (yy_buffer_stack_max) + grow_size;
+		(yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc
+								((yy_buffer_stack),
+								num_to_alloc * sizeof(struct yy_buffer_state*)
+								);
+		if ( ! (yy_buffer_stack) )
+			YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
+
+		/* zero only the new slots.*/
+		memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
+		(yy_buffer_stack_max) = num_to_alloc;
+	}
+}
+
+    void yyFlexLexer::yy_push_state( int new_state )
+{
+    	if ( (yy_start_stack_ptr) >= (yy_start_stack_depth) )
+		{
+		yy_size_t new_size;
+
+		(yy_start_stack_depth) += YY_START_STACK_INCR;
+		new_size = (yy_start_stack_depth) * sizeof( int );
+
+		if ( ! (yy_start_stack) )
+			(yy_start_stack) = (int *) yyalloc(new_size  );
+
+		else
+			(yy_start_stack) = (int *) yyrealloc((void *) (yy_start_stack),new_size  );
+
+		if ( ! (yy_start_stack) )
+			YY_FATAL_ERROR( "out of memory expanding start-condition stack" );
+		}
+
+	(yy_start_stack)[(yy_start_stack_ptr)++] = YY_START;
+
+	BEGIN(new_state);
+}
+
+    void yyFlexLexer::yy_pop_state()
+{
+    	if ( --(yy_start_stack_ptr) < 0 )
+		YY_FATAL_ERROR( "start-condition stack underflow" );
+
+	BEGIN((yy_start_stack)[(yy_start_stack_ptr)]);
+}
+
+    int yyFlexLexer::yy_top_state()
+{
+    	return (yy_start_stack)[(yy_start_stack_ptr) - 1];
+}
+
+#ifndef YY_EXIT_FAILURE
+#define YY_EXIT_FAILURE 2
+#endif
+
+void yyFlexLexer::LexerError( yyconst char msg[] )
+{
+    	std::cerr << msg << std::endl;
+	exit( YY_EXIT_FAILURE );
+}
+
+/* Redefine yyless() so it works in section 3 code. */
+
+#undef yyless
+#define yyless(n) \
+	do \
+		{ \
+		/* Undo effects of setting up yytext. */ \
+        int yyless_macro_arg = (n); \
+        YY_LESS_LINENO(yyless_macro_arg);\
+		yytext[yyleng] = (yy_hold_char); \
+		(yy_c_buf_p) = yytext + yyless_macro_arg; \
+		(yy_hold_char) = *(yy_c_buf_p); \
+		*(yy_c_buf_p) = '\0'; \
+		yyleng = yyless_macro_arg; \
+		} \
+	while ( 0 )
+
+/* Accessor  methods (get/set functions) to struct members. */
+
+/*
+ * Internal utility routines.
+ */
+
+#ifndef yytext_ptr
+static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
+{
+	register int i;
+	for ( i = 0; i < n; ++i )
+		s1[i] = s2[i];
+}
+#endif
+
+#ifdef YY_NEED_STRLEN
+static int yy_flex_strlen (yyconst char * s )
+{
+	register int n;
+	for ( n = 0; s[n]; ++n )
+		;
+
+	return n;
+}
+#endif
+
+void *yyalloc (yy_size_t  size )
+{
+	return (void *) malloc( size );
+}
+
+void *yyrealloc  (void * ptr, yy_size_t  size )
+{
+	/* The cast to (char *) in the following accommodates both
+	 * implementations that use char* generic pointers, and those
+	 * that use void* generic pointers.  It works with the latter
+	 * because both ANSI C and C++ allow castless assignment from
+	 * any pointer type to void*, and deal with argument conversions
+	 * as though doing an assignment.
+	 */
+	return (void *) realloc( (char *) ptr, size );
+}
+
+void yyfree (void * ptr )
+{
+	free( (char *) ptr );	/* see yyrealloc() for (char *) cast */
+}
+
+#define YYTABLES_NAME "yytables"
+
+#line 82 "conv_f8tof1_scanner.l"
+
+
+/**
+  * reset the line and column count
+  */
+void reset_lexer(void)
+{
+	line = 1;
+	col  = 1;    
+}
+
+/**
+  * yyerror() is invoked when the lexer or the parser encounter
+  * an error. The error message is passed via *s
+  */
+void yyerror(char *s)
+{
+	printf("error: %s at line: %d col: %d\n",s,line,col);
+}
+
+/*int yywrap(void)
+{
+	return 1;
+}*/
+
Index: cpp/f8-to-f1/conv_f8tof1_scanner.h
===================================================================
--- cpp/f8-to-f1/conv_f8tof1_scanner.h	(revision 1)
+++ cpp/f8-to-f1/conv_f8tof1_scanner.h	(revision 1)
@@ -0,0 +1,273 @@
+#ifndef yyHEADER_H
+#define yyHEADER_H 1
+#define yyIN_HEADER 1
+
+#line 6 "conv_f8tof1_scanner.h"
+
+#line 8 "conv_f8tof1_scanner.h"
+
+#define  YY_INT_ALIGNED short int
+
+/* A lexical scanner generated by flex */
+
+#define FLEX_SCANNER
+#define YY_FLEX_MAJOR_VERSION 2
+#define YY_FLEX_MINOR_VERSION 5
+#define YY_FLEX_SUBMINOR_VERSION 35
+#if YY_FLEX_SUBMINOR_VERSION > 0
+#define FLEX_BETA
+#endif
+
+    /* The c++ scanner is a mess. The FlexLexer.h header file relies on the
+     * following macro. This is required in order to pass the c++-multiple-scanners
+     * test in the regression suite. We get reports that it breaks inheritance.
+     * We will address this in a future release of flex, or omit the C++ scanner
+     * altogether.
+     */
+    #define yyFlexLexer yyFlexLexer
+
+/* First, we deal with  platform-specific or compiler-specific issues. */
+
+/* begin standard C headers. */
+
+/* end standard C headers. */
+
+/* flex integer type definitions */
+
+#ifndef FLEXINT_H
+#define FLEXINT_H
+
+/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
+
+#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+
+/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
+ * if you want the limit (max/min) macros for int types. 
+ */
+#ifndef __STDC_LIMIT_MACROS
+#define __STDC_LIMIT_MACROS 1
+#endif
+
+#include <inttypes.h>
+typedef int8_t flex_int8_t;
+typedef uint8_t flex_uint8_t;
+typedef int16_t flex_int16_t;
+typedef uint16_t flex_uint16_t;
+typedef int32_t flex_int32_t;
+typedef uint32_t flex_uint32_t;
+#else
+typedef signed char flex_int8_t;
+typedef short int flex_int16_t;
+typedef int flex_int32_t;
+typedef unsigned char flex_uint8_t; 
+typedef unsigned short int flex_uint16_t;
+typedef unsigned int flex_uint32_t;
+
+/* Limits of integral types. */
+#ifndef INT8_MIN
+#define INT8_MIN               (-128)
+#endif
+#ifndef INT16_MIN
+#define INT16_MIN              (-32767-1)
+#endif
+#ifndef INT32_MIN
+#define INT32_MIN              (-2147483647-1)
+#endif
+#ifndef INT8_MAX
+#define INT8_MAX               (127)
+#endif
+#ifndef INT16_MAX
+#define INT16_MAX              (32767)
+#endif
+#ifndef INT32_MAX
+#define INT32_MAX              (2147483647)
+#endif
+#ifndef UINT8_MAX
+#define UINT8_MAX              (255U)
+#endif
+#ifndef UINT16_MAX
+#define UINT16_MAX             (65535U)
+#endif
+#ifndef UINT32_MAX
+#define UINT32_MAX             (4294967295U)
+#endif
+
+#endif /* ! C99 */
+
+#endif /* ! FLEXINT_H */
+
+/* begin standard C++ headers. */
+#include <iostream> 
+#include <errno.h>
+#include <cstdlib>
+#include <cstring>
+/* end standard C++ headers. */
+
+#ifdef __cplusplus
+
+/* The "const" storage-class-modifier is valid. */
+#define YY_USE_CONST
+
+#else	/* ! __cplusplus */
+
+/* C99 requires __STDC__ to be defined as 1. */
+#if defined (__STDC__)
+
+#define YY_USE_CONST
+
+#endif	/* defined (__STDC__) */
+#endif	/* ! __cplusplus */
+
+#ifdef YY_USE_CONST
+#define yyconst const
+#else
+#define yyconst
+#endif
+
+/* Size of default input buffer. */
+#ifndef YY_BUF_SIZE
+#define YY_BUF_SIZE 16384
+#endif
+
+#ifndef YY_TYPEDEF_YY_BUFFER_STATE
+#define YY_TYPEDEF_YY_BUFFER_STATE
+typedef struct yy_buffer_state *YY_BUFFER_STATE;
+#endif
+
+extern int yyleng;
+
+#ifndef YY_TYPEDEF_YY_SIZE_T
+#define YY_TYPEDEF_YY_SIZE_T
+typedef size_t yy_size_t;
+#endif
+
+#ifndef YY_STRUCT_YY_BUFFER_STATE
+#define YY_STRUCT_YY_BUFFER_STATE
+struct yy_buffer_state
+	{
+
+	std::istream* yy_input_file;
+
+	char *yy_ch_buf;		/* input buffer */
+	char *yy_buf_pos;		/* current position in input buffer */
+
+	/* Size of input buffer in bytes, not including room for EOB
+	 * characters.
+	 */
+	yy_size_t yy_buf_size;
+
+	/* Number of characters read into yy_ch_buf, not including EOB
+	 * characters.
+	 */
+	int yy_n_chars;
+
+	/* Whether we "own" the buffer - i.e., we know we created it,
+	 * and can realloc() it to grow it, and should free() it to
+	 * delete it.
+	 */
+	int yy_is_our_buffer;
+
+	/* Whether this is an "interactive" input source; if so, and
+	 * if we're using stdio for input, then we want to use getc()
+	 * instead of fread(), to make sure we stop fetching input after
+	 * each newline.
+	 */
+	int yy_is_interactive;
+
+	/* Whether we're considered to be at the beginning of a line.
+	 * If so, '^' rules will be active on the next match, otherwise
+	 * not.
+	 */
+	int yy_at_bol;
+
+    int yy_bs_lineno; /**< The line count. */
+    int yy_bs_column; /**< The column count. */
+    
+	/* Whether to try to fill the input buffer when we reach the
+	 * end of it.
+	 */
+	int yy_fill_buffer;
+
+	int yy_buffer_status;
+
+	};
+#endif /* !YY_STRUCT_YY_BUFFER_STATE */
+
+void *yyalloc (yy_size_t  );
+void *yyrealloc (void *,yy_size_t  );
+void yyfree (void *  );
+
+/* Begin user sect3 */
+
+#define yytext_ptr yytext
+#define YY_INTERACTIVE
+
+#include <FlexLexer.h>
+
+#ifdef YY_HEADER_EXPORT_START_CONDITIONS
+#define INITIAL 0
+
+#endif
+
+#ifndef YY_NO_UNISTD_H
+/* Special case for "unistd.h", since it is non-ANSI. We include it way
+ * down here because we want the user's section 1 to have been scanned first.
+ * The user has a chance to override it with an option.
+ */
+#include <unistd.h>
+#endif
+
+#ifndef YY_EXTRA_TYPE
+#define YY_EXTRA_TYPE void *
+#endif
+
+#ifndef yytext_ptr
+static void yy_flex_strncpy (char *,yyconst char *,int );
+#endif
+
+#ifdef YY_NEED_STRLEN
+static int yy_flex_strlen (yyconst char * );
+#endif
+
+#ifndef YY_NO_INPUT
+
+#endif
+
+/* Amount of stuff to slurp up with each read. */
+#ifndef YY_READ_BUF_SIZE
+#define YY_READ_BUF_SIZE 8192
+#endif
+
+/* Number of entries by which start-condition stack grows. */
+#ifndef YY_START_STACK_INCR
+#define YY_START_STACK_INCR 25
+#endif
+
+/* Default declaration of generated scanner - a define so the user can
+ * easily add parameters.
+ */
+#ifndef YY_DECL
+#define YY_DECL_IS_OURS 1
+#define YY_DECL int yyFlexLexer::yylex()
+#endif /* !YY_DECL */
+
+/* yy_get_previous_state - get the state just before the EOB char was reached */
+
+#undef YY_NEW_FILE
+#undef YY_FLUSH_BUFFER
+#undef yy_set_bol
+#undef yy_new_buffer
+#undef yy_set_interactive
+#undef YY_DO_BEFORE_ACTION
+
+#ifdef YY_DECL_IS_OURS
+#undef YY_DECL_IS_OURS
+#undef YY_DECL
+#endif
+
+#line 82 "conv_f8tof1_scanner.l"
+
+
+#line 272 "conv_f8tof1_scanner.h"
+#undef yyIN_HEADER
+#endif /* yyHEADER_H */
Index: cpp/f8-to-f1/geno_f8.cpp
===================================================================
--- cpp/f8-to-f1/geno_f8.cpp	(revision 1)
+++ cpp/f8-to-f1/geno_f8.cpp	(revision 1)
@@ -0,0 +1,1301 @@
+/*
+ *  geno_f8.cpp
+ *  L-systemToF1
+ *
+ *  Created by Maciej Wajcht on 08-06-07.
+ *  Copyright 2008 __MyCompanyName__. All rights reserved.
+ *
+ */
+
+#include "geno_f8.h"
+#include <cstdlib>
+//#include <sys/time.h>
+#include "conv_f8tof1.h"
+#include "multimap.h"
+#include <iostream>
+#include <string>
+#include "sstringutils.h"
+#include "conv_f8_utils.h"
+
+#define GENO_F8_DEBUG 1 //0 - off, 1 - on
+
+ProductionInfo::ProductionInfo(SString name, int paramCount) {
+	this->name = name;
+	this->paramCount = paramCount;
+}
+
+Geno_f8::Geno_f8() {
+	supported_format = '8';
+	this->simpleCommandLetters.push_back('X');
+	this->simpleCommandLetters.push_back('R');
+	this->simpleCommandLetters.push_back('r');
+	this->simpleCommandLetters.push_back('C');
+	this->simpleCommandLetters.push_back('c');
+	this->simpleCommandLetters.push_back('Q');
+	this->simpleCommandLetters.push_back('q');
+	this->simpleCommandLetters.push_back('[');
+	this->simpleCommandLetters.push_back(']');
+	this->simpleCommandLetters.push_back('^');
+	this->converter = new GenoConv_F8ToF1();
+	
+#ifdef GENO_F8_DEBUG > 0
+	for (int i = 0; i < F8_OPERATION_COUNT; i++) {
+		this->operation[i] = 1.0 / (double)F8_OPERATION_COUNT;
+	}
+#endif
+}
+
+Geno_f8::~Geno_f8() {
+	delete this->converter;
+}
+
+int Geno_f8::checkValidity(const char * geno) {
+	SString ssgeno = SString(geno);
+	SString f1ssgeno = this->converter->convert(ssgeno, NULL);
+	const char* f1genosrc = f1ssgeno;
+	Geno f1geno(f1genosrc);
+	if (this->converter->checkSyntax(geno) && f1geno.isValid()) {
+		return GENOPER_OK;
+	} else {
+		return 1;
+	}
+}
+
+int Geno_f8::validate(char *& geno) {
+	SString in = geno;
+	SString validated = "";
+	SString line;
+	int pos = 0;
+	bool firstLine = true;
+	bool beforeDelim = true;
+	bool justAfterDelim = false;
+	while (in.getNextToken(pos, line, '\n')) {
+		if (firstLine) {
+			firstLine = false;
+			const char* str = geno;
+			std::istringstream i(str);
+			double x;
+			if (i >> x) {
+				validated += line + "\n";
+			} else {
+				validated += "10\n";
+			}
+		} else if (beforeDelim) {
+			if (line[0] == 'P' && line.indexOf('(') != -1 && line.indexOf(')') != -1 && line.indexOf(':') != -1) {
+				validated += "---\n";
+				validated += line + "\n";
+				beforeDelim = false;
+			}
+			int eqSignPos = line.indexOf('=');
+			if (line[0] == 'n' && eqSignPos != -1) {
+				validated += line + "\n";
+			} else if (line == SString("---")) {
+				validated += line + "\n";
+				beforeDelim = false;
+				justAfterDelim = true;
+			}
+		} else if (justAfterDelim && line[0] == 'P') {
+			const char* digits = "0123456789";
+			SString s = line.substr(1);
+			bool ok = true;
+			for (int i = 0; i < s.len(); i++) {
+				if (!strContainsOneOf(s(i), digits)) {
+					ok = false;
+					break;
+				}
+			}
+			if (ok) {
+				validated += line +"\n";
+			}
+			justAfterDelim = false;
+		} else if (line[0] == 'P' && line.indexOf('(') != -1 && line.indexOf(')') != -1 && line.indexOf(':') != -1) {
+			validated += line + "\n";
+		}
+	}
+	free(geno); //must take care of the original allocation
+	char* validatedTmp = (char*)malloc(strlen(validated) + 1); //allocate for mutated genotype
+	strcpy(validatedTmp, validated); //the rest is originalg = mutated;
+	geno = validatedTmp;
+	
+	return GENOPER_OK;
+}
+
+int Geno_f8::getProductionsCount(const SString &in) {
+	int pos = 0;
+	SString line;
+	int counter = 0;
+	bool beforeDelim = true;
+	while (in.getNextToken(pos, line, '\n')) {
+		if (line.startsWith("---")) {
+			beforeDelim = false;
+			//also skip the start production
+			in.getNextToken(pos, line, '\n');
+			continue;
+		} else if (beforeDelim) {
+			continue;
+		} else {
+			counter++;
+		}				
+	}
+	return counter;
+}
+
+vector<ProductionInfo> Geno_f8::getProductionsInfo(const SString &in) {
+	vector<ProductionInfo> productions;
+	SString line;
+	int pos = 0;
+	bool beforeFirstProd = true;
+	SString firstProdName;
+	while (in.getNextToken(pos, line, '\n')) {
+		if (line.startsWith("P") && line.indexOf('(', 0) == -1) {
+			firstProdName = line;
+			beforeFirstProd = false;
+			continue;
+		}
+		if (beforeFirstProd) {
+			continue;
+		}
+		int lParenIndex = line.indexOf('(', 0);
+		int rParenIndex = line.indexOf(')', 0);
+		if (line[0] == 'P' && lParenIndex != -1 && rParenIndex != -1) {
+			ProductionInfo info;
+			SString prodName = line.substr(0, lParenIndex);
+			info.name = prodName;
+			info.paramCount = 0;
+			//if (line[lParenIndex + 1] == 'n') {
+			SString strParams = line.substr(lParenIndex + 1, rParenIndex - lParenIndex - 1);
+			int pos2 = 0;
+			SString tok;
+			while (strParams.getNextToken(pos2, tok, ',')) {
+				info.paramCount++;
+				info.paramNames.push_back(tok);
+			}
+			//}
+			info.isFirstProduction = (prodName == firstProdName) ? true : false;
+			productions.push_back(info);
+		}
+	}
+	return productions;
+}
+
+SString Geno_f8::mutateChangeBeginningArg(SString &in, float& chg) {
+	SString mutated, line, before, mid, after, tmp;
+	int counter = 0;
+	int pos = 0;
+	bool afterDelim = false;
+	bool firstLine = true;
+	while (in.getNextToken(pos, line, '\n')) {
+		if (firstLine) {
+			firstLine = false;
+			before += line + "\n";
+			continue;
+		}
+		if (afterDelim) {
+			after += line + "\n";
+			continue;
+		} 
+		if (line.startsWith("---")) {
+			afterDelim = true;
+			after += line + "\n";					
+		} else {
+			mid += line + "\n";
+			counter++;
+		}				
+	}
+	if (counter == 0) {
+		chg = 0.0;
+		mutated = in;
+	} else {
+		int randNbr = randomN(counter);
+		pos = 0;
+		counter = 0;
+		while (mid.getNextToken(pos, line, '\n')) {
+			if (counter++ == randNbr) {
+				int pos2 = 0;
+				SString tok;
+				line.getNextToken(pos2, tok, '=');
+				tmp += tok + "=";
+				line.getNextToken(pos2, tok, '=');
+				double arg = parseDouble(tok);
+				arg += (double) (randomN(11) - 5); //-5..5
+				tmp += SString::valueOf(arg) + "\n";
+				chg = (float) (SString::valueOf(arg).len()) / (float) in.len();
+			} else {
+				tmp += line + "\n";
+			}
+		}
+		mid = tmp;
+		mutated += before;
+		mutated += mid;
+		mutated += after;
+	}
+	return mutated;
+}
+
+SString Geno_f8::mutateChangeArg(SString &in, float& chg) {
+	SString mutated;
+	
+	Lsystem *newLsystem = this->converter->createLsystem(in);
+	if (newLsystem == NULL) {
+		mutated += in;
+		chg = 0.0;
+		return mutated;
+	}
+	
+	vector<Production*> interestingProductions;
+	
+	for (map<string, Production*>::iterator prodIter = newLsystem->productions.begin();
+		 prodIter != newLsystem->productions.end(); prodIter++) {
+		if (prodIter->second->parameters.size() > 0) {
+			interestingProductions.push_back(prodIter->second);
+		}
+	}
+	
+	if (interestingProductions.size() > 0) {
+		int rnd = randomN(interestingProductions.size());
+		
+		Production *randomProduction = interestingProductions[rnd];
+		SString prodName = randomProduction->name;
+		
+		int paramIndex = randomN(randomProduction->parameters.size());
+		
+		for (map<string, Production*>::iterator prodIter = newLsystem->productions.begin();
+			 prodIter != newLsystem->productions.end(); prodIter++) {
+			vector<SubProduction> *subproductions = &(prodIter->second->subproductions);
+			for (vector<SubProduction>::iterator subProdIter = subproductions->begin();
+				 subProdIter != subproductions->end(); subProdIter++) {
+				SubProduction *sp = &(*subProdIter);
+				for (vector<ActionStrP>::iterator actionIter = sp->actions.begin();
+					 actionIter != sp->actions.end(); actionIter++) {
+					if ((*actionIter).action != NULL && (*actionIter).action->name == prodName && (*actionIter).params.size() > paramIndex) {
+						SString param = (*actionIter).params[paramIndex];
+						int counter = 0;
+						int pos = 0;
+						SString tok;
+						while (in.getNextToken(pos, tok, ',')) {
+							counter++;
+						}
+						int rnd = randomN(counter);
+						pos = 0;
+						counter = 0;
+						SString newParam = "";
+						if (randomN(2) == 0 || prodIter->second->parameters.size() == 0) {
+							int rnd2 = randomN(5) + 1;
+							newParam += param + SString::valueOf(rnd2) + ";";
+						} else {
+							SString paramName = prodIter->second->parameters.getParameterName(randomN(prodIter->second->parameters.size())+1);
+							newParam += param + paramName + ";";
+						}
+						newParam += (rnd == 0) ? SString("+;") : SString("-;");
+						(*actionIter).params[paramIndex] = newParam;
+						goto label;
+					}
+				}
+			}
+		}
+	label:
+		chg = 2.0 / (float) in.len();
+	}
+	
+	mutated = newLsystem->toString();
+	
+	delete newLsystem;
+	
+	return mutated;
+}
+
+SString Geno_f8::mutateDeleteCommand(SString &in, float& chg) {
+	SString mutated;
+	
+	Lsystem *lsystem = this->converter->createLsystem(in);
+	if (lsystem == NULL) {
+		mutated += in;
+		chg = 0.0;
+		return mutated;
+	}
+	
+	map<string, Production*>::iterator prodIter = lsystem->productions.begin();
+	for (int i = 0; i < randomN(lsystem->productions.size()); i++) {
+		if (i != 0) {
+			prodIter++;
+		}
+	}
+	
+	Production *randomProduction = prodIter->second;
+	if (randomProduction->subproductions.size() > 0) {
+		vector<ActionStrP> *actions = &(randomProduction->subproductions.at(randomN(randomProduction->subproductions.size())).actions);
+		int rnd = randomN(actions->size());
+		if (actions->size() > 0) {
+			Action *a = actions->at(rnd).action;
+			if (a != NULL) {
+				chg = (float) (a->getF8Representation().len()) / (float) in.len();
+				actions->erase(actions->begin() + rnd);
+			}
+		}
+	}
+	
+	mutated = lsystem->toString();
+	
+	delete lsystem;
+	
+	return mutated;
+}
+
+SString Geno_f8::mutateInsertCommands(SString &in, float& chg) {
+	SString mutated;
+	
+	//cout << "insertCommands 1" << endl;
+	Lsystem *lsystem = this->converter->createLsystem(in);
+	if (lsystem == NULL) {
+		mutated += in;
+		chg = 0.0;
+		return mutated;
+	}
+	
+	//cout << "insertCommands 2" << endl;
+	vector<Action*> actions = lsystem->getAllActions(true, true, false, false);
+	//cout << "insertCommands 3" << endl;
+	
+	int random1 = randomN(lsystem->productions.size());
+	
+	map<string, Production*>::iterator prodIter = lsystem->productions.begin();
+	for (int counter = 0; counter < random1; counter++) {
+		prodIter++;
+	}
+	//cout << "insertCommands 4" << endl;
+	
+	Production *p = prodIter->second;
+	SubProduction *sp = &(p->subproductions.at(randomN(p->subproductions.size())));
+	
+	int commandsToInsert = /*randomN(3) +*/ 1;
+	int insertLen = 0;
+	for (int i = 0; i < commandsToInsert; i++) {
+		ActionStrP a;
+		a.action = actions.at(randomN(actions.size()));
+		insertLen += a.action->getF8Representation().len();
+		if (a.action->ignoreParams == false && a.action->name[0] == 'P') {
+			Production *p = (Production*) a.action;
+			insertLen += 2;
+			for (int j = 0; j < p->parameters.size(); j++) {
+				int rnd = randomN(p->parameters.size() + 1);
+				if (rnd == 0) {
+					a.params.push_back(SString("0;"));
+					insertLen += 1;
+				} else {
+					SString s = p->parameters.getParameterName(randomN(p->parameters.size()) + 1);
+					a.params.push_back(s + ";");
+					insertLen += s.len();
+				}
+			}
+		}
+		sp->actions.push_back(a);
+	}
+	//cout << "insertCommands 5" << endl;
+	
+	mutated = lsystem->toString();
+	//cout << "insertCommands 6" << endl;
+	chg = (float) insertLen / (float) in.len();
+	
+	delete lsystem;	
+	//cout << "insertCommands 7" << endl;
+			
+	return mutated;
+}
+
+SString Geno_f8::mutateEncapsulate(SString &in, float& chg) {
+	SString mutated;
+	
+	Lsystem *lsystem = this->converter->createLsystem(in);
+	if (lsystem == NULL) {
+		mutated += in;
+		chg = 0.0;
+		return mutated;
+	}
+	
+	int counter = 0;
+	int rnd = randomN(lsystem->productions.size());
+	int len = 0;
+	
+	Production *p = new Production();
+	p->subproductions.push_back(SubProduction());
+	SubProduction *newSubProd = &(p->subproductions.back());
+	
+	for (map<string, Production*>::iterator prodIter = lsystem->productions.begin();
+		 prodIter != lsystem->productions.end(); prodIter++) {
+		if (counter++ == rnd) {
+			ParameterCollection *params = &(prodIter->second->parameters);
+			//copy parameters to the encapsulated production
+			for (int i = 1; i <= params->size(); i++) {
+				p->parameters.addParameter(params->getParameterName(i));
+			}
+			
+			SubProduction *subproduction = &(prodIter->second->subproductions[randomN(prodIter->second->subproductions.size())]);
+			int firstActionIdx = randomN(subproduction->actions.size());
+			int i;
+			vector<ActionStrP> newActions;
+			for (i = 0; i < firstActionIdx; i++) {
+				newActions.push_back(subproduction->actions[i]);
+			}
+			for (i = firstActionIdx; i <= firstActionIdx + randomN(4) + 1 
+				 && i < subproduction->actions.size(); i++) { //1..4 actions
+				newSubProd->actions.push_back(subproduction->actions[i]);
+				if (subproduction->actions[i].action != NULL) {
+					len += subproduction->actions[i].action->getF8Representation().len();
+				}
+			}
+			ActionStrP a;
+			a.action = p;
+			a.params = vector<SString>();
+			for (int j = 0; j < params->size(); j++) {
+				//a.params.push_back(SString("0;"));
+				a.params.push_back(params->getParameterName(j + 1));
+			}
+			newActions.push_back(a);
+			while (i < subproduction->actions.size()) {
+				if (subproduction->actions[i].action != NULL) {
+					newActions.push_back(subproduction->actions[i]);
+				}
+				i++;
+			}
+			subproduction->actions = newActions;
+			break;
+		}		
+	}
+	
+	SString newName;
+	for (int i = 0; i < 100000; i++) {
+		newName = "P";
+		newName += SString::valueOf(i);
+		if (lsystem->productions[sstringToString(newName)] == NULL) {
+			break;
+		}
+	}	
+	p->name = newName;
+	lsystem->productions[sstringToString(newName)] = p;
+	
+	mutated = lsystem->toString();
+	
+	delete lsystem;
+	
+	chg = (float) len / (float) in.len();
+	return mutated;
+}
+
+SString Geno_f8::mutateChangeConditionSign(SString &in, float& chg) {
+	SString mutated;
+	
+	Lsystem *newLsystem = this->converter->createLsystem(in);
+	if (newLsystem == NULL) {
+		mutated += in;
+		chg = 0.0;
+		return mutated;
+	}
+	
+	map<int, SubProduction*> interestingSubproductions;
+	int counter = 0;
+	
+	for (map<string, Production*>::iterator prodIter = newLsystem->productions.begin();
+		 prodIter != newLsystem->productions.end(); prodIter++) {
+		for (vector<SubProduction>::iterator subprodIter = prodIter->second->subproductions.begin();
+			 subprodIter != prodIter->second->subproductions.end(); subprodIter++) {
+			SubProduction *sp = &(*subprodIter);
+			if (sp->conditions.size() > 0) {
+				interestingSubproductions[counter++] =  sp;
+			}
+		}
+	}
+	
+	if (interestingSubproductions.size() > 0) {
+		int random1 = randomN(interestingSubproductions.size());
+		SubProduction *randomSubproduction = interestingSubproductions[random1];
+		int random2 = randomN(randomSubproduction->conditions.size());
+		Condition *c = &(randomSubproduction->conditions.at(random2));
+		c->relation = (c->relation == r_greater) ? r_lessEqual :
+				(c->relation == r_greaterEqual) ? r_less :
+				(c->relation == r_less) ? r_greaterEqual :
+				(c->relation == r_lessEqual) ? r_greater :
+				(c->relation == r_equal) ? r_different :
+				r_equal;
+		chg = 2.0 / (float) in.len();
+	}
+	
+	mutated = newLsystem->toString();
+	
+	delete newLsystem;
+	
+	return mutated;
+}
+
+SString Geno_f8::mutateAddParameter(SString &in, float& chg) {
+	SString mutated;
+	
+	Lsystem *lsystem = this->converter->createLsystem(in);
+	if (lsystem == NULL) {
+		mutated += in;
+		chg = 0.0;
+		return mutated;
+	}
+	
+	//cout << "addParameter 1" << endl;
+	int rnd = randomN(lsystem->productions.size());
+	int chglen = 0;
+	
+	SString prodName = "";
+	
+	int counter = 0;
+	for (map<string, Production*>::iterator prodIter = lsystem->productions.begin();
+		 prodIter != lsystem->productions.end(); prodIter++) {
+		if (counter++ == rnd) {
+			prodName = prodIter->second->name;
+			SString newParam;
+			for (int i = 0; i < 10000; i++) {
+				newParam = "n";
+				newParam += SString::valueOf(i);
+				if (!prodIter->second->parameters.paramExist(newParam)) {
+					prodIter->second->parameters.addParameter(newParam);
+					chglen += newParam.len();
+					break;
+				}
+			}
+			
+			if (prodName == stringToSString(lsystem->firstProductionName)) {
+				lsystem->startParams[sstringToString(newParam)] = 0.0;
+			}
+			break;
+		}
+	}
+	//cout << "addParameter 2" << endl;
+	for (map<string, Production*>::iterator prodIter = lsystem->productions.begin();
+		 prodIter != lsystem->productions.end(); prodIter++) {
+		for (vector<SubProduction>::iterator subprodIter = prodIter->second->subproductions.begin();
+			 subprodIter != prodIter->second->subproductions.end(); subprodIter++) {
+			for (vector<ActionStrP>::iterator actionIter = (*subprodIter).actions.begin();
+				 actionIter != (*subprodIter).actions.end(); actionIter++) {
+				if ((*actionIter).action != NULL && (*actionIter).action->name != NULL) { 
+					if ((*actionIter).action->name == prodName) {
+						int randParamVal = randomN(prodIter->second->parameters.size() + 1);
+						SString paramVal = NULL;
+						if (randParamVal == 0) {
+							paramVal = "0;";
+						} else {
+							paramVal = prodIter->second->parameters.getParameterName(randParamVal) + ";";
+						}
+						//(*actionIter).params.push_back(paramVal);
+						chglen += 2;
+					}
+				}
+			}
+		}
+	}
+	//cout << "addParameter 3" << endl;
+	
+	mutated = lsystem->toString();
+	//cout << "addParameter 4" << endl;
+	
+	delete lsystem;
+	
+	chg = (float) chglen / (float) in.len();
+	return mutated;
+}
+
+SString Geno_f8::mutateAddCondition(SString &in, float& chg) {
+	SString mutated, before, mid, after, line;
+	vector<ProductionInfo> prodInfo = this->getProductionsInfo(in);
+	vector<int> interestingProductions;
+	for (int i = 0; i < prodInfo.size(); i++) {
+		if (prodInfo[i].paramNames.size() > 0) {
+			interestingProductions.push_back(i);
+		}
+	}
+	if (interestingProductions.size() == 0) {
+		chg = 0.0;
+		mutated = in;
+		return mutated;
+	}
+	int rndProd = interestingProductions[randomN(interestingProductions.size())];
+	int pos = 0;
+	mutated = "";
+	while (in.getNextToken(pos, line, '\n')) {
+		if (line.startsWith(prodInfo[rndProd].name) && line.len() > prodInfo[rndProd].name.len()) {
+			int subproductionsCount = -1;
+			SString tok;
+			int pos2 = 0;
+			while (line.getNextToken(pos2, tok, ':')) {
+				subproductionsCount++;
+			}
+			if (subproductionsCount == 0) {
+				chg = 0.0;
+				mutated = in;
+				return mutated;
+			}
+			int rnd = randomN(subproductionsCount);
+			int counter = 0;
+			int colonIdx = line.indexOf(':', 0);
+			pos2 = colonIdx;
+			while (counter != rnd) {
+				colonIdx = line.indexOf(':', pos2 + 1);
+				counter++;
+			}
+			
+			int nextColonIdx = line.indexOf(':', colonIdx + 1);
+			if (nextColonIdx == -1) {
+				nextColonIdx = 2147483646;
+			}
+			int pipeIdx = line.indexOf('|', colonIdx + 1);
+			mid = "";
+			if (pipeIdx < nextColonIdx && pipeIdx != -1) {
+				//before += line.substr(colonIdx + 1, pipeIdx - colonIdx - 1);
+				before = line.substr(0, pipeIdx);
+				mid += ",";
+				after = line.substr(pipeIdx);				
+			} else {
+				before = line.substr(0, colonIdx + 1);
+				after = SString("|") + line.substr(colonIdx + 1);
+			}
+			int paramIdx = (int) randomN(prodInfo[rndProd].paramNames.size());
+			mid += prodInfo[rndProd].paramNames[paramIdx];
+			mid += (randomN(2) == 0) ? ">" : "<";
+			mid += SString::valueOf((int) randomN(21) - 10);
+			
+			mutated += before + mid + after + "\n";
+			chg = (float) mid.len() / (float)in.len();
+		} else {
+			mutated += line + "\n";
+		}
+	}
+	return mutated;
+}
+
+SString Geno_f8::mutateDeleteParameter(SString &in, float& chg) {
+	SString mutated;
+	
+	Lsystem *newLsystem = this->converter->createLsystem(in);
+	if (newLsystem == NULL) {
+		mutated += in;
+		chg = 0.0;
+		return mutated;
+	}
+		
+	map<int, Production*> interestingProductions;
+	int counter = 0;
+	
+	for (map<string, Production*>::iterator prodIter = newLsystem->productions.begin();
+			prodIter != newLsystem->productions.end(); prodIter++) {
+		if (prodIter->second->parameters.size() > 0) {
+			interestingProductions[counter++] =  prodIter->second;
+		}
+	}
+	
+	if (interestingProductions.size() > 0) {
+		int rnd = randomN(interestingProductions.size());
+		
+		Production *randomProduction = interestingProductions[rnd];
+		SString prodName = randomProduction->name;
+		
+		int paramIndex = randomN(randomProduction->parameters.size()) + 1;
+		SString paramName = randomProduction->parameters.getParameterName(paramIndex);
+		string sparamName = sstringToString(paramName);
+		int change = paramName.len();
+		
+		randomProduction->parameters.removeParameter(paramName);
+		
+		if (prodName == stringToSString(newLsystem->firstProductionName)) {
+			newLsystem->startParams.erase(sstringToString(paramName));
+		}
+		
+		for (vector<SubProduction>::iterator subProdIter = randomProduction->subproductions.begin();
+				subProdIter != randomProduction->subproductions.end(); subProdIter++) {
+			for (int condIter = 0; condIter < (*subProdIter).conditions.size(); condIter++) {
+				Condition c = (*subProdIter).conditions[condIter];
+				if (c.parameter == paramName) {
+					(*subProdIter).conditions.erase((*subProdIter).conditions.begin() + condIter);
+				}
+			}
+			for (vector<ActionStrP>::iterator actionIter = (*subProdIter).actions.begin();
+					actionIter != (*subProdIter).actions.end(); actionIter++) {
+				for (vector<SString>::iterator paramIter = (*actionIter).params.begin();
+						paramIter != (*actionIter).params.end(); paramIter++) {
+					string s = sstringToString(*paramIter);
+					if (s.find(sparamName, 0) != string::npos) {
+						*paramIter = SString("0;");
+					}
+				}
+			}
+		}
+				
+		for (map<string, Production*>::iterator prodIter = newLsystem->productions.begin();
+				prodIter != newLsystem->productions.end(); prodIter++) {
+			vector<SubProduction> *subproductions = &(prodIter->second->subproductions);
+			for (vector<SubProduction>::iterator subProdIter = subproductions->begin();
+			    	subProdIter != subproductions->end(); subProdIter++) {
+				SubProduction *sp = &(*subProdIter);
+				for (int actionIter = 0; actionIter < sp->actions.size(); actionIter++) {
+					ActionStrP *actionstrp = &(sp->actions.at(actionIter));
+					if (actionstrp->action != NULL) {
+						if (actionstrp->action->name == prodName && actionstrp->params.size() > paramIndex - 1) {
+							change += paramName.len(); //more less
+							actionstrp->params.erase(actionstrp->params.begin() + (paramIndex - 1));
+						}
+					}
+				}
+			}
+		}
+		chg = (float) change / (float) in.len();
+	}
+	
+	mutated = newLsystem->toString();
+	
+	delete newLsystem;
+	
+	return mutated;
+}
+
+SString Geno_f8::mutateDeleteCondition(SString &in, float& chg) {
+	SString mutated;
+	
+	Lsystem *newLsystem = this->converter->createLsystem(in);
+	if (newLsystem == NULL) {
+		mutated += in;
+		chg = 0.0;
+		return mutated;
+	}
+		
+	map<int, SubProduction*> interestingSubproductions;
+	int counter = 0;
+	
+	for (map<string, Production*>::iterator prodIter = newLsystem->productions.begin();
+		 prodIter != newLsystem->productions.end(); prodIter++) {
+		for (vector<SubProduction>::iterator subprodIter = prodIter->second->subproductions.begin();
+			 subprodIter != prodIter->second->subproductions.end(); subprodIter++) {
+			SubProduction *sp = &(*subprodIter);
+			if (sp->conditions.size() > 0) {
+				interestingSubproductions[counter++] =  sp;
+			}
+		}
+	}
+	
+	if (interestingSubproductions.size() > 0) {
+		int rnd = randomN(interestingSubproductions.size());
+		SubProduction *randomSubproduction = interestingSubproductions[rnd];
+		vector<Condition>::iterator condIter = randomSubproduction->conditions.begin();
+		condIter += randomN(randomSubproduction->conditions.size() - 1);
+		Condition c = *condIter;
+		chg = (float) (c.parameter.len() + 1 + SString::valueOf(c.value).len()) / (float) in.len();
+		randomSubproduction->conditions.erase(condIter);
+	}
+	
+	mutated = newLsystem->toString();
+	
+	delete newLsystem;
+	
+	return mutated;
+}
+
+SString Geno_f8::mutateAddLoop(SString &in, float& chg) {
+	/*
+	 * Podczas wczytania genotypu do obiektu typu Lsystem nastepuje rozwiniecie petli, wiec kolejne mutacje
+	 * zniweczyly by zysk ktory mozna uzyskac dzieki petlom. Dlatego nic nie zmieniamy.
+	 */
+	SString mutated, line;
+	int pos = 0;
+	while (in.getNextToken(pos, line, '\n')) {
+		mutated += line + "\n";
+	}
+	chg = 0.0;
+	return mutated;
+}
+
+SString Geno_f8::mutateDeleteLoop(SString &in, float& chg) {
+	/*
+	 * Podczas wczytania genotypu do obiektu typu Lsystem nastepuje rozwiniecie petli, wiec kolejne mutacje
+	 * zniweczyly by zysk ktory mozna uzyskac dzieki petlom. Dlatego nic nie zmieniamy.
+	 */
+	SString mutated, line;
+	int pos = 0;
+	while (in.getNextToken(pos, line, '\n')) {
+		mutated += line + "\n";
+	}
+	chg = 0.0;
+	return mutated;
+}
+
+SString Geno_f8::mutateAddSubproduction(SString &in, float& chg) {
+	SString mutated, line;
+	vector<ProductionInfo> prodInfo = this->getProductionsInfo(in);
+	int rndProd = randomN(prodInfo.size());
+	int pos = 0;
+	mutated = "";
+	while (in.getNextToken(pos, line, '\n')) {
+		if (line.startsWith(prodInfo[rndProd].name) && line.indexOf(':', 0) != -1) {
+			SString tmp = ":";
+			int paramCount = prodInfo[rndProd].paramNames.size();
+			if (paramCount > 0) {
+				tmp += prodInfo[rndProd].paramNames[(int) randomN(paramCount)];
+				tmp += (randomN(2) == 0) ? ">" : "<";
+				tmp += SString::valueOf((int) randomN(21) - 10);
+				tmp += "|";
+			}
+			tmp += "X\n";
+			chg = (float) tmp.len() / (float) in.len();
+			mutated += line + tmp;
+		} else {
+			mutated += line + "\n";
+		}
+	}
+	return mutated;
+}
+
+SString Geno_f8::mutateChangeIterationsNumber(SString &in, float& chg) {
+	SString mutated;	
+	Lsystem *newLsystem = this->converter->createLsystem(in);
+	if (newLsystem == NULL) {
+		mutated += in;
+		chg = 0.0;
+		return mutated;
+	}
+	
+	newLsystem->iterations += randomN(7) - 3; //-3..3
+	if (newLsystem->iterations < 1) {
+		newLsystem->iterations = 1;
+	}
+	mutated = newLsystem->toString();	
+	delete newLsystem;	
+	chg = 1.0 / (float) in.len();
+	return mutated;
+}
+
+int Geno_f8::mutate(char *&g,float& chg, int &method) {
+	SString in = g;
+	
+	/*struct timeval tv;
+	gettimeofday(&tv, NULL);
+	srandom(tv.tv_sec + tv.tv_usec);
+	*/
+	method = roulette(this->operation, F8_OPERATION_COUNT);
+	if (method < 0) {
+		return GENOPER_OPFAIL;
+	}
+	
+#if GENO_F8_DEBUG > 0
+	string mutationName = (method == 0) ? "F8_CHANGE_BEGINNING_ARG" :
+	(method == 1) ? "F8_CHANGE_ARG" :
+	(method == 2) ? "F8_DELETE_COMMAND" :
+	(method == 3) ? "F8_INSERT_COMMANDS" :
+	(method == 4) ? "F8_ENCAPSULATE" :
+	(method == 5) ? "F8_CHANGE_CONDITION_SIGN" :
+	(method == 6) ? "F8_REPLACE_COMMAND" :
+	(method == 7) ? "F8_ADD_PARAMETER" :
+	(method == 8) ? "F8_ADD_CONDITION" :
+	(method == 9) ? "F8_ADD_SUBPRODUCTION" :
+	(method == 10) ? "F8_CHANGE_ITERATIONS_NUMBER" :
+	(method == 11) ? "F8_DELETE_PARAMETER" :
+	(method == 12) ? "F8_DELETE_CONDITION" :
+	(method == 13) ? "F8_ADD_LOOP" :
+	(method == 14) ? "F8_DELETE_LOOP" :
+	(method == 15) ? "F8_OPERATION_COUNT" : "babol";
+	//cout << "-------------------- " << mutationName << " --------------------" << endl;
+#endif
+	
+	const char* mutatedTmp;
+	SString ssMutatedTmp;
+	
+	//cout << "mutate 1" << endl;
+	//TODO dodac parametr ok, mowiacy, czy wszystko bylo ok
+	switch (method) {
+		case F8_CHANGE_BEGINNING_ARG:
+			ssMutatedTmp = this->mutateChangeBeginningArg(in, chg);
+			break;
+		case F8_CHANGE_ARG:
+			ssMutatedTmp = this->mutateChangeArg(in, chg);
+			break;
+		case F8_DELETE_COMMAND:
+			ssMutatedTmp = this->mutateDeleteCommand(in, chg);
+			break;
+		case F8_INSERT_COMMANDS:
+			ssMutatedTmp = this->mutateInsertCommands(in, chg);
+			break;
+		case F8_ENCAPSULATE:
+			ssMutatedTmp = this->mutateEncapsulate(in, chg);
+			break;
+		case F8_CHANGE_CONDITION_SIGN:
+			ssMutatedTmp = this->mutateChangeConditionSign(in, chg);
+			break;
+		/*case F8_REPLACE_COMMAND:
+			ssMutatedTmp = this->mutateReplaceCommand(in, chg);
+			break;*/
+		case F8_ADD_PARAMETER:
+			ssMutatedTmp = this->mutateAddParameter(in, chg);
+			break;
+		case F8_ADD_CONDITION:
+			ssMutatedTmp = this->mutateAddCondition(in, chg);
+			break;
+		case F8_ADD_SUBPRODUCTION:
+			ssMutatedTmp = this->mutateAddSubproduction(in, chg);
+			break;
+		case F8_CHANGE_ITERATIONS_NUMBER:
+			ssMutatedTmp = this->mutateChangeIterationsNumber(in, chg);
+			break;
+		case F8_DELETE_PARAMETER:
+			ssMutatedTmp = this->mutateDeleteParameter(in, chg);
+			break;
+		case F8_DELETE_CONDITION:
+			ssMutatedTmp = this->mutateDeleteCondition(in, chg);
+			break;
+		case F8_ADD_LOOP:
+			ssMutatedTmp = this->mutateAddLoop(in, chg);
+			break;
+		case F8_DELETE_LOOP:
+			ssMutatedTmp = this->mutateDeleteLoop(in, chg);
+			break;
+		default:
+			return GENOPER_OPFAIL;
+	}
+	
+	//cout << "mutate 2" << endl;
+	if (ssMutatedTmp.len() < 16) {
+		return GENOPER_OPFAIL;
+	}
+	
+	mutatedTmp = ssMutatedTmp;
+	
+	if (this->checkValidity(mutatedTmp) == GENOPER_OK) { 
+		free(g); //must take care of the original allocation
+		g = (char*)malloc(strlen(mutatedTmp) + 1); //allocate for mutated genotype
+		strcpy(g, mutatedTmp); //the rest is originalg = mutated;
+		//cout << "mutate 3" << endl;
+	} else {
+		chg = 0.0;
+	}
+	
+	return GENOPER_OK;
+}
+
+int Geno_f8::crossOver(char *&g1,char *&g2,float& chg1,float& chg2) {
+	/* wymiana niewielkiej (max. 25%) ilości odpowiadającej sobie informacji
+	 * ma to przypominać "celowaną" mutację, w której osobnik dostaje
+	 * niewiele wiedzy, która sprawdziła się u innego osobnika
+	 */
+	SString in1 = g1;
+	SString in2 = g2;
+	SString mutated;
+	//SString dst;
+	//const char* src = in;
+	//const char* t;
+	
+	Lsystem *newLsystem = this->converter->createLsystem(in1);
+	Lsystem *lsystem2 = this->converter->createLsystem(in2);
+	if (newLsystem == NULL || lsystem2 == NULL) {
+		chg1 = 0.0;
+		chg2 = 0.0;
+		return GENOPER_OPFAIL;
+	}
+	
+	//shuffle second parent's productions
+	vector<int> indices;
+	for (int i = 0; i < lsystem2->productions.size(); i++) {
+		indices.push_back(i);
+	}
+	map<string, Production*> shuffledProductions;
+	while (!indices.empty()) {
+		int rnd = randomN(indices.size());
+		int counter = 0;
+		//Production *p;
+		for (map<string, Production*>::iterator it = lsystem2->productions.begin();
+			 it != lsystem2->productions.end(); it++) {
+			if (counter == rnd) {
+				//p = it->second;
+				shuffledProductions[it->first] = it->second;
+				break;
+			}
+		}
+		//delete index number
+		indices.erase(indices.begin() + rnd);
+	}
+	
+	int productionCount = randomN(min(newLsystem->productions.size() / 4, lsystem2->productions.size())) + 1;
+	
+	int counter = 0;
+	for (map<string, Production*>::iterator it = shuffledProductions.begin(); 
+		 it != shuffledProductions.end() || counter < productionCount; it++) {
+		//if selected production's name exist in the first parent
+		if (newLsystem->productions.find(it->first) != newLsystem->productions.end()) {
+			newLsystem->productions[it->first]->subproductions = it->second->subproductions;
+			counter++;
+		} else {
+			/* This fragment is commented out because we are interested only in matching productions ///////
+			//search for first production, which name does not exist in one of the productions
+			//selected from second parent
+			//this is to avoid information loss when new subproductions will be overwritten
+			//just after adding to the child production
+			for (map<string, Production*>::iterator it2 = newLsystem->productions.begin();
+				 it2 != newLsystem->productions.end(); it2++) {
+				if (shuffledProductions.find(it2->first) == shuffledProductions.end()) { //not found
+					it2->second->subproductions = it->second->subproductions;
+					break;
+				}
+				//there are no "else" because there is at least twice as many productions
+				//in the first parent as selected productions from the second parent
+				//so always we will find "free" production name
+			}*/
+		}		
+	}
+	
+	//check validity of productions indicated in actions
+	for (map<string, Production*>::iterator prodIter = newLsystem->productions.begin();
+		 prodIter != newLsystem->productions.end(); prodIter++) {
+		vector<SString> paramNames;
+		for (int i = 1; i <= prodIter->second->parameters.size(); i++) {
+			paramNames.push_back(prodIter->second->parameters.getParameterName(i));
+		}
+		for (vector<SubProduction>::iterator subprodIter = prodIter->second->subproductions.begin();
+			 subprodIter != prodIter->second->subproductions.end(); subprodIter++) {
+			//conditions
+			for (vector<Condition>::iterator condIter = (*subprodIter).conditions.begin();
+				 condIter != (*subprodIter).conditions.end(); condIter++) {
+				vector<SString>::iterator searchIter = find(paramNames.begin(), paramNames.end(), 
+															(*condIter).parameter);
+				if (searchIter == paramNames.end()) { //unknown parameter name!
+					//choose random existing parameter
+					(*condIter).parameter = paramNames[randomN(paramNames.size())];
+				}
+			}
+			
+			//actions
+			for (vector<ActionStrP>::iterator actionIter = (*subprodIter).actions.begin();
+				 actionIter != (*subprodIter).actions.end(); actionIter++) {
+				SString &actionName = (*actionIter).action->name;
+				if (actionName[0] == 'n') {
+					vector<SString>::iterator searchIter = find(paramNames.begin(), paramNames.end(), 
+																actionName);
+					if (searchIter != paramNames.end()) { //valid name
+						//ensure it is linked to the correct production
+						(*actionIter).action = newLsystem->getParamProduction(actionName);
+					} else {
+						//link to random parameter prodution
+						SString name = paramNames[randomN(paramNames.size())];
+						(*actionIter).action = newLsystem->getParamProduction(name);
+					}
+				} else if (actionName[0] == 'P') {
+					if (newLsystem->productions.find(sstringToString(actionName)) != newLsystem->productions.end()) {
+						//ensure it is linked to the correct production
+						(*actionIter).action = newLsystem->productions[sstringToString(actionName)];
+					} else {
+						//delete this action
+						(*subprodIter).actions.erase(actionIter);
+					}
+				}
+			}
+			if ((*subprodIter).actions.size() == 0) { //we erased all the actions
+				ActionStrP a;
+				a.action = newLsystem->getPrimitiveProduction(SString("X"));
+				(*subprodIter).actions.push_back(a);
+			}
+		}
+	}
+	
+	mutated = newLsystem->toString();
+	
+	shuffledProductions.clear();
+	
+	delete newLsystem;
+	delete lsystem2;
+	
+	free(g1); //must take care of the original allocation
+	//free(g2);
+	const char* mutatedTmp = mutated;
+	char* mutatedTmp2 = (char*)malloc(strlen(mutatedTmp) + 1); //allocate for mutated genotype
+    strcpy(mutatedTmp2, mutatedTmp); //the rest is originalg = mutated;
+	g1 = mutatedTmp2;
+	chg1 = 0.5;
+	
+	return GENOPER_OK;	
+}
+
+unsigned long Geno_f8::style(const char *g, int pos) {
+	return GENSTYLE_RGBS(0, 0, 0, GENSTYLE_NONE);
+}
+
+char* Geno_f8::getSimplest() {
+	const char* geno = "1\n---\nP0\nP0():X\n";
+	char* retGeno = (char*)malloc(strlen(geno) + 1);
+	strcpy(retGeno, geno);
+	return retGeno;
+}
+
+bool Geno_f8::checkProdNameExist(vector<ProductionInfo> info, SString name) const {
+	for (vector<ProductionInfo>::iterator it = info.begin(); it != info.end(); it++) {
+		if ((*it).name == name) {
+			return true;
+		}
+	}
+	return false;
+}
+
+bool Geno_f8::checkParamNameExist(vector<SString> names, SString name) const {
+	for (vector<SString>::iterator it = names.begin(); it != names.end(); it++ ) {
+		if ((*it) == name) {
+			return true;
+		}
+	}
+	return false;
+}
+
+SString Geno_f8::getOppositeCondition(const SString &c) const {
+	if (c.equals("=="))
+		return "!=";
+	if (c.equals("!="))
+		return "==";
+	if (c.equals(">"))
+		return "<=";
+	if (c.equals("<"))
+		return ">=";
+	if (c.equals(">="))
+		return "<";
+	if (c.equals("<="))
+		return ">";
+	return "<"; //default
+}
+
+SString Geno_f8::removeProductionCalls(const SString production) const {
+	SString line = trimSString(production);
+	SString result = "";
+	bool skip = false;
+	for (int i = 0; i < line.len(); i++) {
+		if (skip) {
+			if (line[i] == ')') {
+				skip = false;
+			} else {
+				//do nothing
+			}
+		} else {
+			if (line[i] == 'P') {
+				skip = true;
+			} else {
+				result += line[i];
+			}
+		}
+	}
+	return result;
+}
+
+SString Geno_f8::addParameterToCalls(const SString line, SString &prodName) {
+	SString newStr = "";
+	int colonIdx = line.indexOf(':', 0);
+	if (colonIdx != -1 && line.indexOf(prodName, colonIdx) != -1) {
+		int pos2 = colonIdx;
+		int beginIdx = 0;
+		int prodIdx;
+		while ((prodIdx = line.indexOf(prodName, pos2)) != -1) {
+			int indexRBrace = line.indexOf(')', prodIdx);
+			newStr += line.substr(beginIdx, indexRBrace);
+			if (newStr[newStr.len() - 1] != '(') {
+				newStr += SString(",");
+			}
+			newStr += "0.0";
+			beginIdx = indexRBrace;
+			pos2 = indexRBrace;
+		}
+		newStr += line.substr(pos2);
+	} else {
+		newStr = line;
+	}
+	return newStr;
+}
+
+SString Geno_f8::deleteParameterFromCalls(const SString line, SString &prodName, int paramIdx) {
+	SString newStr = "";
+	SString tmp, before, mid, midTmp;
+	mid = "";
+	int colonIdx = line.indexOf(':', 0);
+	if (colonIdx != -1 && line.indexOf(prodName, colonIdx) != -1) {
+		int pos2 = colonIdx;
+		int beginIdx = 0;
+		int prodIdx;
+		while ((prodIdx = line.indexOf(prodName, pos2)) != -1) {
+			int indexRBrace = line.indexOf(')', prodIdx);
+			before = line.substr(beginIdx, prodIdx + prodName.len() + 1);
+			midTmp = line.substr(prodIdx + prodName.len() + 1, indexRBrace - (prodIdx + prodName.len() + 1));
+			pos2 = 0;
+			SString tok;
+			int i = 0;
+			while (midTmp.getNextToken(pos2, tok, ',')) {
+				if (i++ == paramIdx) {
+					//do nothing
+				} else {
+					mid += tok + ",";
+				}
+			}
+			if (mid[mid.len() - 1] == ',') {
+				mid = mid.substr(0, mid.len() - 1);
+			}
+			
+			newStr += before + mid + ")";
+			beginIdx = indexRBrace;
+			pos2 = indexRBrace;
+		}
+		newStr += line.substr(pos2 + 1);
+	} else {
+		newStr = line;
+	}
+	return newStr;
+}
+
+SString Geno_f8::testMutate(SString &in, int method) {
+	/*struct timeval tv;
+	gettimeofday(&tv, NULL);
+	srandom(tv.tv_sec + tv.tv_usec);
+	*/
+	SString mutatedTmp;
+	float chg = 0.0;
+	switch (method) {
+		case F8_CHANGE_BEGINNING_ARG:
+			mutatedTmp = this->mutateChangeBeginningArg(in, chg);
+			break;
+		case F8_CHANGE_ARG:
+			mutatedTmp = this->mutateChangeArg(in, chg);
+			break;
+		case F8_DELETE_COMMAND:
+			mutatedTmp = this->mutateDeleteCommand(in, chg);
+			break;
+		case F8_INSERT_COMMANDS:
+			mutatedTmp = this->mutateInsertCommands(in, chg);
+			break;
+		case F8_ENCAPSULATE:
+			mutatedTmp = this->mutateEncapsulate(in, chg);
+			break;
+		case F8_CHANGE_CONDITION_SIGN:
+			mutatedTmp = this->mutateChangeConditionSign(in, chg);
+			break;
+		/*case F8_REPLACE_COMMAND:
+			mutatedTmp = this->mutateReplaceCommand(in, chg);
+			break;*/
+		case F8_ADD_PARAMETER:
+			mutatedTmp = this->mutateAddParameter(in, chg);
+			break;
+		case F8_ADD_CONDITION:
+			mutatedTmp = this->mutateAddCondition(in, chg);
+			break;
+		case F8_ADD_SUBPRODUCTION:
+			mutatedTmp = this->mutateAddSubproduction(in, chg);
+			break;
+		case F8_CHANGE_ITERATIONS_NUMBER:
+			mutatedTmp = this->mutateChangeIterationsNumber(in, chg);
+			break;
+		case F8_DELETE_PARAMETER:
+			mutatedTmp = this->mutateDeleteParameter(in, chg);
+			break;
+		case F8_DELETE_CONDITION:
+			mutatedTmp = this->mutateDeleteCondition(in, chg);
+			break;
+		case F8_ADD_LOOP:
+			mutatedTmp = this->mutateAddLoop(in, chg);
+			break;
+		case F8_DELETE_LOOP:
+			mutatedTmp = this->mutateDeleteLoop(in, chg);
+			break;
+		default:
+			mutatedTmp = "";
+	}
+	return mutatedTmp;
+	
+}
Index: cpp/f8-to-f1/geno_f8.h
===================================================================
--- cpp/f8-to-f1/geno_f8.h	(revision 1)
+++ cpp/f8-to-f1/geno_f8.h	(revision 1)
@@ -0,0 +1,99 @@
+/*
+ *  geno_f8.h
+ *  L-systemToF1
+ *
+ *  Created by Maciej Wajcht on 08-06-07.
+ *  Copyright 2008 __MyCompanyName__. All rights reserved.
+ *
+ */
+
+#ifndef _GENO_F8_H_
+#define _GENO_F8_H_
+
+#include "param.h"
+#include "sstring.h"
+#include "geno_fx.h"
+#include <vector>
+#include "conv_f8tof1.h"
+
+using namespace std;
+
+//indices in array with probabilities of mutation operators
+#define F8_CHANGE_BEGINNING_ARG 0
+#define F8_CHANGE_ARG 1
+#define F8_DELETE_COMMAND 2
+#define F8_INSERT_COMMANDS 3
+#define F8_ENCAPSULATE 4
+#define F8_CHANGE_CONDITION_SIGN 5
+//#define F8_REPLACE_COMMAND 6
+#define F8_ADD_PARAMETER 6
+#define F8_ADD_CONDITION 7
+#define F8_ADD_SUBPRODUCTION 8
+#define F8_CHANGE_ITERATIONS_NUMBER 9
+#define F8_DELETE_PARAMETER 10
+#define F8_DELETE_CONDITION 11
+#define F8_ADD_LOOP 12
+#define F8_DELETE_LOOP 13
+#define F8_OPERATION_COUNT 14
+
+class ProductionInfo {
+public:
+	ProductionInfo() {};
+	ProductionInfo(SString name, int paramCount);
+	SString name;
+	int paramCount;
+	vector<SString> paramNames;
+	bool isFirstProduction;
+};
+
+class Geno_f8 : public Geno_fx {
+public:
+	Geno_f8();
+	~Geno_f8();
+	
+	//probabilities of mutation operators
+	double operation[F8_OPERATION_COUNT];
+	
+	int checkValidity(const char * geno);
+	int validate(char * &geno);
+	int mutate(char *&g,float& chg, int &method);
+	int crossOver(char *&g1,char *&g2,float& chg1,float& chg2);
+	unsigned long style(const char *g, int pos);
+	char* getSimplest();
+	
+	SString testMutate(SString &in, int method);
+protected:
+	GenoConv_F8ToF1 *converter;
+	static const int maxTotalIterations = 200;
+	static const int maxNormalIterations = 100;
+	
+	vector<char> simpleCommandLetters;
+	
+	int getProductionsCount(const SString &in);
+	vector<ProductionInfo> getProductionsInfo(const SString &in);
+	bool checkProdNameExist(vector<ProductionInfo> info, SString name) const;
+	bool checkParamNameExist(vector<SString> names, SString name) const;
+	SString getOppositeCondition(const SString &c) const;
+	SString removeProductionCalls(const SString production) const;
+	SString mutateChangeBeginningArg(SString &in, float& chg);
+	SString mutateChangeArg(SString &in, float& chg);
+	SString mutateDeleteCommand(SString &in, float& chg);
+	SString mutateInsertCommands(SString &in, float& chg);
+	//SString mutateReplaceCommand(SString &in, float& chg);
+	//SString mutateInsertReplaceCommand(SString &in, float& chg, bool replace);
+	SString mutateEncapsulate(SString &in, float& chg);
+	SString mutateChangeConditionSign(SString &in, float& chg);
+	SString mutateAddParameter(SString &in, float& chg);
+	SString mutateAddCondition(SString &in, float& chg);
+	SString mutateDeleteParameter(SString &in, float& chg);
+	SString mutateDeleteCondition(SString &in, float& chg);
+	SString mutateAddLoop(SString &in, float& chg);
+	SString mutateDeleteLoop(SString &in, float& chg);
+	SString mutateAddSubproduction(SString &in, float& chg);
+	SString mutateChangeIterationsNumber(SString &in, float& chg);
+	SString addParameterToCalls(const SString line, SString &prodName);
+	SString deleteParameterFromCalls(const SString line, SString &prodName, int paramIdx);
+};
+
+#endif
+
Index: cpp/f8-to-f1/lemonglobal.h
===================================================================
--- cpp/f8-to-f1/lemonglobal.h	(revision 1)
+++ cpp/f8-to-f1/lemonglobal.h	(revision 1)
@@ -0,0 +1,31 @@
+/*
+ *  lemonglobal.h
+ *  L-systemToF1
+ *
+ *  Created by Maciej Wajcht on 08-04-04.
+ *  Copyright 2008 __MyCompanyName__. All rights reserved.
+ *
+ */
+#include "conv_f8tof1.h"
+#include "sstring.h"
+
+struct Token {
+	double dblValue;
+	//int intValue;
+	SString *strValue;
+	char strArrValue[30];
+	vector<SString> *vectorStr;
+	vector<Condition> *vectorConditions;
+	vector<Action*> *vectorActions;
+	vector<vector<SString> > *parameters;
+	Condition *cond;
+};
+
+struct ProductionTailToken {
+	vector<SubProduction> *subproductions;
+};
+
+struct ProdPieceToken {
+	vector<vector<SString> > *parameters;
+	vector<Action*> *actions;
+};
Index: cpp/f8-to-f1/lexglobal.h
===================================================================
--- cpp/f8-to-f1/lexglobal.h	(revision 1)
+++ cpp/f8-to-f1/lexglobal.h	(revision 1)
@@ -0,0 +1,24 @@
+/*
+ *  lexglobal.h
+ *  L-systemToF1
+ *
+ *  Created by Maciej Wajcht on 08-03-28.
+ *  Copyright 2008 __MyCompanyName__. All rights reserved.
+ *
+ */
+
+#ifndef YYSTYPE
+#include "sstring.h"
+
+typedef struct {
+	double dblVal;
+	SString strVal;
+	struct symtab *symp;
+} yystype;
+# define YYSTYPE yystype
+# define YYSTYPE_IS_TRIVIAL 1
+
+#endif
+
+/* extern YYSTYPE yylval; */
+//YYSTYPE yylval;
