Hi Amanda and Samuel, Le mardi 21 février 2017 à 22:34 +0100, Samuel Gougeon a écrit : > > But i don't understand how sci_macr2tree.c separates the function code from > > all SciLAB's memory. > > I think the SciLAB macro memory it's like a binary stream without any > > markers that define where > > a macro starts or ends.
Just to clarify and provide more information about the global design of Scilab 6 by my understanding. There is only one module called "ast" [1] involved in parsing, interpreting, values (or types) definition. Sub-directories (both inside includes/ or src/cpp/) implement theses behaviors. A bison/flex parser is used to allocate Exp (for expressions) [2] based on the syntax, all the Exp objects then represent an abstract syntax tree of any Scilab code. To interpret the code, we do use intermediate bytecode but simply implemented a "visitor pattern" that traverses the Exp objects interpreting each Exp and passing values around. So the old-school switch/case bytecode interpreter is replaced by a `visit(Exp*)` function dispatch for each Exp class. Values allocated by matrix definitions (by the parser) or function calls are all defined by Type objects [3]. And most of our gateways are now using these internal Type management rather than API Scilab to distinguish internal API and external API (aka API Scilab). Note: the macr2tree is implemented as a visitor that encode each Exp to a specific Type, it just traverses the Exp tree to reproduce a Scilab 5 compatible values encoding. [1]: modules/ast [2]: modules/ast/includes/exps and modules/ast/includes/exps/exp.hxx [3]: modules/ast/includes/types and modules/ast/includes/types/internal.hxx Regards, -- Clément _______________________________________________ dev mailing list [email protected] http://lists.scilab.org/mailman/listinfo/dev
