Esempio n. 1
0
        private void translate_Frame_Subspace(ParseTreeNode node)
        {
            try
            {
                Context.MarkCheckPointState();

                Context.PushState(_generatedFrame.ChildSymbolScope, RoleNames.FrameSubspace);

                //Read the name of the new subspace
                var subspaceName = TranslateChildSymbolName(node.ChildNodes[0]);

                BooleanPattern subspacePattern =
                    GMacFrameSubspacePatternGenerator.Translate(Context, node.ChildNodes[1], _generatedFrame);

                var frameSubspace = _generatedFrame.DefineSubspace(subspaceName, subspacePattern);

                frameSubspace.CodeLocation = Context.GetCodeLocation(node);

                Context.PopState();

                Context.UnmarkCheckPointState();
                Context.CompilationLog.ReportNormal("Translated Frame Subspace: " + frameSubspace.SymbolAccessName, ProgressEventArgsResult.Success);
            }
            catch (CompilerException)
            {
                Context.RestoreToCheckPointState();
                Context.CompilationLog.ReportNormal("Translate Frame Subspace Failed: " + _generatedFrame.SymbolAccessName, ProgressEventArgsResult.Failure);
            }
            catch (Exception e)
            {
                Context.RestoreToCheckPointState();
                Context.CompilationLog.ReportError("Translate Frame Subspace Failed With Error: " + _generatedFrame.SymbolAccessName, e);
            }
        }
Esempio n. 2
0
        private LanguageValueAccess translate_Qualified_BasisBladeCoefficient(ParseTreeNode node)
        {
            var valAccess = translate_Qualified_Identifier(node.ChildNodes[0]);

            if (!valAccess.ExpressionType.IsFrameMultivector())
            {
                return(CompilationLog.RaiseGeneratorError <LanguageValueAccess>("cannot find basis blade coefficient",
                                                                                RootParseNode));
            }

            var frame = ((GMacFrameMultivector)valAccess.ExpressionType).ParentFrame;

            var basisBladesIds = GMacFrameSubspacePatternGenerator.Translate(Context, node.ChildNodes[1], frame);

            return(valAccess.Append(basisBladesIds.FirstTrueIndex, GMacRootAst.ScalarType));
        }
        /// <summary>
        /// Translate the boolean pattern of a GMac frame subspace
        /// </summary>
        /// <param name="context"></param>
        /// <param name="node"></param>
        /// <param name="frame"></param>
        /// <returns></returns>
        public static MutableBooleanPattern Translate(GMacSymbolTranslatorContext context, ParseTreeNode node, GMacFrame frame)
        {
            context.PushState(node);

            var translator = new GMacFrameSubspacePatternGenerator();//new GMacFrameSubspacePatternGenerator(context, frame);

            translator.SetContext(context, frame);
            translator.Translate();

            context.PopState();

            var result = translator._generatedBooleanPattern;

            //MasterPool.Release(translator);

            return(result);
        }
        private int translate_BasisBladeCoefficient(GMacFrameMultivector mvType, ParseTreeNode node)
        {
            var basisBladesIds = GMacFrameSubspacePatternGenerator.Translate(Context, node, mvType.ParentFrame);

            return(basisBladesIds.FirstTrueIndex);
        }