static ProduireProgramGeneratorHelper() { Sign2BinaryOperator = UnifiedProgramGeneratorHelper.CreateBinaryOperatorDictionary (); Sign2PrefixUnaryOperator = UnifiedProgramGeneratorHelper. CreatePrefixUnaryOperatorDictionaryForJava(); }
public static UnifiedExpression CreateShiftExpression(XElement node) { Contract.Requires(node != null); Contract.Requires(node.Name() == "shift_expression"); /* * shift_expression * : additive_expression (('<<'|'>>') additive_expression)* */ return(UnifiedProgramGeneratorHelper.CreateBinaryExpression( node, CreateAdditiveExpression, Sign2BinaryOperator)); }
public static UnifiedExpression CreateEqualityExpression(XElement node) { Contract.Requires(node != null); Contract.Requires(node.Name() == "equality_expression"); /* * equality_expression * : relational_expression (('=='|'!=') relational_expression)* */ return(UnifiedProgramGeneratorHelper.CreateBinaryExpression( node, CreateRelationalExpression, Sign2BinaryOperator)); }
public static UnifiedExpression CreateAndExpression(XElement node) { Contract.Requires(node != null); Contract.Requires(node.Name() == "and_expression"); /* * and_expression * : equality_expression ('&' equality_expression)* */ return(UnifiedProgramGeneratorHelper.CreateBinaryExpression( node, CreateEqualityExpression, Sign2BinaryOperator)); }
public static UnifiedExpression CreateAdditiveExpression(XElement node) { Contract.Requires(node != null); Contract.Requires(node.Name() == "additive_expression"); /* * additive_expression * : (multiplicative_expression) ('+' multiplicative_expression | '-' multiplicative_expression)* */ return(UnifiedProgramGeneratorHelper.CreateBinaryExpression( node, CreateMultiplicativeExpression, Sign2BinaryOperator)); }
public static UnifiedExpression CreateRelationalExpression( XElement node) { Contract.Requires(node != null); Contract.Requires(node.Name() == "relational_expression"); /* * relational_expression * : shift_expression (('<'|'>'|'<='|'>=') shift_expression)* */ return(UnifiedProgramGeneratorHelper.CreateBinaryExpression( node, CreateShiftExpression, Sign2BinaryOperator)); }
public static UnifiedExpression CreateExclusiveOrExpression( XElement node) { Contract.Requires(node != null); Contract.Requires(node.Name() == "exclusive_or_expression"); /* * exclusive_or_expression * : and_expression ('^' and_expression)* */ return(UnifiedProgramGeneratorHelper.CreateBinaryExpression( node, CreateAndExpression, Sign2BinaryOperator)); }
public static UnifiedExpression CreateLogicalAndExpression( XElement node) { Contract.Requires(node != null); Contract.Requires(node.Name() == "logical_and_expression"); /* * logical_and_expression * : inclusive_or_expression ('&&' inclusive_or_expression)* */ return(UnifiedProgramGeneratorHelper.CreateBinaryExpression( node, CreateInclusiveOrExpression, Sign2BinaryOperator)); }
static Ruby18ProgramGeneratorHelper() { Sign2BinaryOperator = UnifiedProgramGeneratorHelper.CreateBinaryOperatorDictionary (); Sign2PrefixUnaryOperator = UnifiedProgramGeneratorHelper. CreatePrefixUnaryOperatorDictionaryForJava(); ExpressionFuncs = new Dictionary <string, Func <XElement, UnifiedExpression> >(); InitializeExpressions(); InitializeLiterals(); InitializeDefinitions(); InitializeControlFlows(); }
public static UnifiedExpression CreateUnaryExpression(XElement node) { Contract.Requires(node != null); Contract.Requires(node.Name() == "unary_expression"); /* * unary_expression * : postfix_expression | '++' unary_expression | '--' unary_expression | unary_operator cast_expression | 'sizeof' unary_expression | 'sizeof' '(' type_name ')' */ var first = node.FirstElement(); if (first.Name == "postfix_expression") { return (CreatePostfixExpression( node.Element("postfix_expression"))); } if (first.Value == "sizeof") { var expression = node.NthElement(1).Name == "unary_expression" ? CreateUnaryExpression ( node . NthElement ( 1)) : CreateTypeName(node.NthElement(2)); UnifiedSizeof.Create(expression); } if (first.Name == "unary_operator") { return(UnifiedProgramGeneratorHelper.CreatePrefixUnaryExpression ( node, CreateCastExpression, Sign2PrefixUnaryOperator)); } return(UnifiedProgramGeneratorHelper.CreatePrefixUnaryExpression( node, CreateUnaryExpression, Sign2PrefixUnaryOperator)); }