Exemplo n.º 1
0
        public Node ParameterDeclaration()
        {
            var identifierNode = new Identifier()
            {
                AnchorToken = Expect(TokenCategory.IDENTIFIER)
            };

            while (CurrentToken == TokenCategory.COMMA)
            {
                var commaNode = new Identifier()
                {
                    AnchorToken = Expect(TokenCategory.COMMA)
                };
                var identifier2 = new Identifier()
                {
                    AnchorToken = Expect(TokenCategory.IDENTIFIER)
                };
                commaNode.Add(identifierNode);
                commaNode.Add(identifier2);

                identifierNode = commaNode;
            }

            var paramNode = new Parameter_Declaration()
            {
                AnchorToken = Expect(TokenCategory.DECL)
            };

            paramNode.Add(identifierNode);
            paramNode.Add(Type());

            Expect(TokenCategory.EOL);
            return(paramNode);
        }
Exemplo n.º 2
0
        /****************************************************************
         *       Identifier and Real Special Case Auxiliary Method
         ***************************************************************/

        private Node IdentifierFound()
        {
            var identifier = new Identifier()
            {
                AnchorToken = Expect(TokenCategory.IDENTIFIER)
            };

            if (CurrentToken == TokenCategory.PARENTHESIS_OPEN)
            {
                identifier.Add(new ParenthesisOpen()
                {
                    AnchorToken = Expect(TokenCategory.PARENTHESIS_OPEN)
                });

                if (CurrentToken != TokenCategory.PARENTHESIS_CLOSE)
                {
                    var expr = Expression();
                    identifier.Add(expr);

                    while (CurrentToken == TokenCategory.COMMA)
                    {
                        Expect(TokenCategory.COMMA);
                        expr = Expression();
                        identifier.Add(expr);
                    }
                }

                identifier.Add(new ParenthesisClose()
                {
                    AnchorToken = Expect(TokenCategory.PARENTHESIS_CLOSE)
                });
            }
            return(identifier);
        }
Exemplo n.º 3
0
        public Node Call(Token identifier)
        {
            var callNode = new Call_Expression()
            {
                AnchorToken = identifier
            };

            Expect(TokenCategory.PARENTHESIS_OPEN);
            if (CurrentToken != TokenCategory.PARENTHESIS_CLOSE)
            {
                var expr1 = Expression();
                while (CurrentToken == TokenCategory.COMMA)
                {
                    var commaNode = new Identifier()
                    {
                        AnchorToken = Expect(TokenCategory.COMMA)
                    };
                    commaNode.Add(expr1);
                    commaNode.Add(Expression());

                    expr1 = commaNode;
                }

                callNode.Add(expr1);
            }
            Expect(TokenCategory.PARENTHESIS_CLOSE);


            return(callNode);
        }
Exemplo n.º 4
0
        public Node CallStatement(Token identifier)
        {
            var callStatement = new Call_Statement()
            {
                AnchorToken = identifier
            };

            Expect(TokenCategory.PARENTHESIS_OPEN);
            if (CurrentToken != TokenCategory.PARENTHESIS_CLOSE)
            {
                var expr1 = Expression();
                while (CurrentToken == TokenCategory.COMMA)
                {
                    var expr2 = new Identifier()
                    {
                        AnchorToken = Expect(TokenCategory.COMMA)
                    };
                    expr2.Add(expr1);
                    expr2.Add(Expression());
                    expr1 = expr2;
                }
                Expect(TokenCategory.PARENTHESIS_CLOSE);
                Expect(TokenCategory.EOL);

                callStatement.Add(expr1);
            }
            else
            {
                Expect(TokenCategory.PARENTHESIS_CLOSE);
                Expect(TokenCategory.EOL);
            }

            return(callStatement);
        }
Exemplo n.º 5
0
        public Node ConstantDeclaration()
        {
            var constNode = new Constant_Declaration()
            {
                AnchorToken = Expect(TokenCategory.CONST)
            };

            while (CurrentToken == TokenCategory.IDENTIFIER)
            {
                var identifierNode = new Identifier()
                {
                    AnchorToken = Expect(TokenCategory.IDENTIFIER)
                };
                var assignmentNode = new Identifier()
                {
                    AnchorToken = Expect(TokenCategory.ASSIGN)
                };

                assignmentNode.Add(identifierNode);
                assignmentNode.Add(Literal());
                Expect(TokenCategory.EOL);

                constNode.Add(assignmentNode);
            }


            return(constNode);
        }
Exemplo n.º 6
0
        /****************************************************************
         *                          Read Node
         ***************************************************************/

        public Node Read()
        {
            var rdResult = new Read()
            {
                AnchorToken = Expect(TokenCategory.READ)
            };

            if (this.labelCache != null)
            {
                rdResult.Add(this.labelCache);
                this.labelCache = null;
            }

            Expect(TokenCategory.PARENTHESIS_OPEN);
            Expect(TokenCategory.MUL);
            Expect(TokenCategory.COMMA);
            Expect(TokenCategory.MUL);
            Expect(TokenCategory.PARENTHESIS_CLOSE);

            var readTo = new Identifier()
            {
                AnchorToken = Expect(TokenCategory.IDENTIFIER)
            };

            if (CurrentToken == TokenCategory.PARENTHESIS_OPEN)
            {
                readTo.Add(ArrayDeclaration());
            }
            rdResult.Add(readTo);

            while (firstOfMultipleDeclarations.Contains(CurrentToken))
            {
                if (CurrentToken == TokenCategory.PARENTHESIS_OPEN)
                {
                    readTo.Add(ArrayDeclaration());
                    rdResult.Add(readTo);
                }

                else if (CurrentToken == TokenCategory.COMMA)
                {
                    Expect(TokenCategory.COMMA);
                    readTo = new Identifier()
                    {
                        AnchorToken = Expect(TokenCategory.IDENTIFIER)
                    };

                    if (CurrentToken != TokenCategory.PARENTHESIS_OPEN)
                    {
                        rdResult.Add(readTo);
                    }
                }
            }
            return(rdResult);
        }
Exemplo n.º 7
0
        /****************************************************************
         *                        Assignment Node
         ***************************************************************/

        public Node Assignment()
        {
            var assgnResult = new Assignment();

            if (this.labelCache != null)
            {
                assgnResult.Add(this.labelCache);
                this.labelCache = null;
            }

            var id = new Identifier()
            {
                AnchorToken = Expect(TokenCategory.IDENTIFIER)
            };

            if (CurrentToken == TokenCategory.PARENTHESIS_OPEN)
            {
                id.Add(ArrayDeclaration());
            }

            var assgnToken = Expect(TokenCategory.ASSIGN);
            var expr       = Expression();

            assgnResult.Add(id);
            assgnResult.Add(expr);
            assgnResult.AnchorToken = assgnToken;
            return(assgnResult);
        }
Exemplo n.º 8
0
        public Node AssignmentStatement(Token identifier)
        {
            var identifierNode = new Identifier()
            {
                AnchorToken = identifier
            };

            if (CurrentToken == TokenCategory.BRACKETS_OPEN)
            {
                Expect(TokenCategory.BRACKETS_OPEN);
                identifierNode.Add(Expression());
                Expect(TokenCategory.BRACKETS_CLOSE);
            }

            var assignmentNode = new Assignment_Statement()
            {
                AnchorToken = Expect(TokenCategory.ASSIGN)
            };

            assignmentNode.Add(identifierNode);
            assignmentNode.Add(Expression());


            Expect(TokenCategory.EOL);


            return(assignmentNode);
        }
Exemplo n.º 9
0
        /****************************************************************
         *                       Declaration Node
         ***************************************************************/

        public Node Declaration()
        {
            var declResult = new Declaration()
            {
                AnchorToken = Type()
            };

            var declId = new Identifier()
            {
                AnchorToken = Expect(TokenCategory.IDENTIFIER)
            };

            if (CurrentToken == TokenCategory.PARENTHESIS_OPEN)
            {
                declId.Add(ArrayDeclaration());
            }
            declResult.Add(declId);

            while (firstOfMultipleDeclarations.Contains(CurrentToken))
            {
                if (CurrentToken == TokenCategory.PARENTHESIS_OPEN)
                {
                    declId.Add(ArrayDeclaration());
                    declResult.Add(declId);
                }

                else if (CurrentToken == TokenCategory.COMMA)
                {
                    Expect(TokenCategory.COMMA);
                    declId = new Identifier()
                    {
                        AnchorToken = Expect(TokenCategory.IDENTIFIER)
                    };

                    if (CurrentToken != TokenCategory.PARENTHESIS_OPEN)
                    {
                        declResult.Add(declId);
                    }
                }
            }
            return(declResult);
        }
Exemplo n.º 10
0
        public Node VariableDeclaration()
        {
            var varNode = new Variable_Declaration();

            varNode.AnchorToken = Expect(TokenCategory.VAR);

            while (CurrentToken == TokenCategory.IDENTIFIER)
            {
                var id1Node = new Identifier()
                {
                    AnchorToken = Expect(TokenCategory.IDENTIFIER)
                };
                while (CurrentToken == TokenCategory.COMMA)
                {
                    var commaNode = new Identifier()
                    {
                        AnchorToken = Expect(TokenCategory.COMMA)
                    };
                    var id2Node = new Identifier()
                    {
                        AnchorToken = Expect(TokenCategory.IDENTIFIER)
                    };

                    commaNode.Add(id1Node);
                    commaNode.Add(id2Node);

                    id1Node = commaNode;
                }
                var declNode = new Identifier()
                {
                    AnchorToken = Expect(TokenCategory.DECL)
                };
                declNode.Add(id1Node);
                declNode.Add(Type());

                Expect(TokenCategory.EOL);
                varNode.Add(declNode);
            }

            return(varNode);
        }
Exemplo n.º 11
0
        public Node assignStatement(Token identifier)
        {
            var id = new Identifier()
            {
                AnchorToken = identifier
            };
            var result = new Assignment();

            if (CurrentToken == TokenCategory.SQUAREDBRACKET_OPEN)
            {
                Expect(TokenCategory.SQUAREDBRACKET_OPEN);
                id.Add(Expression());
                Expect(TokenCategory.SQUAREDBRACKET_CLOSE);
            }
            result.Add(id);
            result.AnchorToken = Expect(TokenCategory.ASSIGN);
            result.Add(Expression());
            Expect(TokenCategory.SEMICOL);
            return(result);
        }
Exemplo n.º 12
0
        //<expr-primary>//
        public Node ExprPrimary()
        {
            var xprPri = new Node();
            var funky  = new Node();

            switch (CurrentToken)
            {
            case TokenCategory.IDENTIFIER:
                var myT = Expect(TokenCategory.IDENTIFIER);
                funky = new FunCall()
                {
                    AnchorToken = myT
                };
                xprPri = new Identifier()
                {
                    AnchorToken = myT
                };

                if (CurrentToken == TokenCategory.PARENTHESIS_OPEN)
                {
                    xprPri = funky;
                    Expect(TokenCategory.PARENTHESIS_OPEN);
                    xprPri.Add(ExpressionList());
                    Expect(TokenCategory.PARENTHESIS_CLOSE);
                }
                break;

            case TokenCategory.BRACKET_OPEN:
                Expect(TokenCategory.BRACKET_OPEN);
                xprPri = ExpressionList("Array");
                Expect(TokenCategory.BRACKET_CLOSE);
                break;

            case TokenCategory.STR_LITERAL:
                xprPri = new StringLiteral()
                {
                    AnchorToken = Expect(TokenCategory.STR_LITERAL)
                };
                break;

            case TokenCategory.CHAR_LITERAL:
                xprPri = new CharLiteral()
                {
                    AnchorToken = Expect(TokenCategory.CHAR_LITERAL)
                };
                break;

            case TokenCategory.INT_LITERAL:
                xprPri = new IntLiteral()
                {
                    AnchorToken = Expect(TokenCategory.INT_LITERAL)
                };
                break;

            case TokenCategory.PARENTHESIS_OPEN:
                Expect(TokenCategory.PARENTHESIS_OPEN);
                xprPri = Expression();
                Expect(TokenCategory.PARENTHESIS_CLOSE);
                break;

            default:
                throw new SyntaxError(firstExprPrimary,
                                      tokenStream.Current);
            }
            return(xprPri);
        }
Exemplo n.º 13
0
        public Node List()
        {
            var listLiteral = new ListLiteralNode();

            if (CurrentToken == TokenCategory.KEY_OPEN)
            {
                Expect(TokenCategory.KEY_OPEN);
                var litList = SimpleLiteral();
                while (CurrentToken == TokenCategory.COMMA)
                {
                    var commaNode = new Identifier()
                    {
                        AnchorToken = Expect(TokenCategory.COMMA)
                    };
                    commaNode.Add(litList);
                    commaNode.Add(SimpleLiteral());

                    litList = commaNode;
                }
                listLiteral.Add(litList);
                Expect(TokenCategory.KEY_CLOSE);
            }
            if (CurrentToken == TokenCategory.BRACKETS_OPEN)
            {
                Expect(TokenCategory.BRACKETS_OPEN);
                if (CurrentToken != TokenCategory.IDENTIFIER)
                {
                    var litList = SimpleLiteral();
                    while (CurrentToken == TokenCategory.COMMA)
                    {
                        var commaNode = new Identifier()
                        {
                            AnchorToken = Expect(TokenCategory.COMMA)
                        };
                        commaNode.Add(litList);
                        commaNode.Add(SimpleLiteral());

                        litList = commaNode;
                    }
                    listLiteral.Add(litList);
                }
                else
                {
                    var expList = Expression();
                    while (CurrentToken == TokenCategory.COMMA)
                    {
                        var commaNode = new Identifier()
                        {
                            AnchorToken = Expect(TokenCategory.COMMA)
                        };
                        commaNode.Add(expList);
                        commaNode.Add(Expression());

                        expList = commaNode;
                    }
                    listLiteral.Add(expList);
                }

                Expect(TokenCategory.BRACKETS_CLOSE);
            }

            return(listLiteral);
        }
Exemplo n.º 14
0
        public Node ProcedureDeclaration()
        {
            var procedureNode = new Procedure_Declaration()
            {
                AnchorToken = Expect(TokenCategory.PROCEDURE)
            };

            var procedureName = new Identifier()
            {
                AnchorToken = Expect(TokenCategory.IDENTIFIER)
            };

            var declList = new Declaration_List();
            var stmtList = new Statement_List();

            Expect(TokenCategory.PARENTHESIS_OPEN);
            while (CurrentToken == TokenCategory.IDENTIFIER)
            {
                declList.Add(ParameterDeclaration());
            }
            Expect(TokenCategory.PARENTHESIS_CLOSE);

            if (CurrentToken == TokenCategory.DECL)
            {
                var declNode = new Identifier()
                {
                    AnchorToken = Expect(TokenCategory.DECL)
                };
                declNode.Add(procedureName);
                declNode.Add(Type());

                procedureNode.Add(declNode);
            }
            else
            {
                procedureNode.Add(procedureName);
            }

            Expect(TokenCategory.EOL);


            while (CurrentToken == TokenCategory.CONST)
            {
                declList.Add(ConstantDeclaration());
            }
            while (CurrentToken == TokenCategory.VAR)
            {
                declList.Add(VariableDeclaration());
            }


            stmtList.AnchorToken = (Expect(TokenCategory.BEGIN));
            while (firstOfStatement.Contains(CurrentToken))
            {
                stmtList.Add(Statement());
            }
            Expect(TokenCategory.END);
            Expect(TokenCategory.EOL);

            procedureName.Add(declList);
            procedureName.Add(stmtList);

            return(procedureNode);
        }
Exemplo n.º 15
0
		private SLE.Expression Generate(MJCP.Expression Input)
		{
			Init ();
			SLE.Expression result = null;
			if (Input == null)
				return null;
			List<SLE.Expression> arguments;
			List<SLE.Expression> initializers;
			SLE.Expression right;

			MJCP.BinaryOperatorExpression binOp;
			switch (Input.Opcode) {

				case MJCP.Expression.Operation.SyntaxError :
					return null;//sample show null
				case MJCP.Expression.Operation.@this :
					//TODO this must not be a variable!
					if (withinFunction > 1)//if this is call inside a function
						result = SLE.Expression.Read (builder.CreateVariable (GetSymbolId(thisIdent), SLE.Variable.VariableKind.Global, null));
					else {//if this is call ouside of function
						arguments = new List<SLE.Expression> ();
						arguments.Add (SLE.Expression.CodeContext ());
						result = SLE.Expression.Call (typeof (MJR.JSOps).GetMethod ("GetGlobalObject"), arguments.ToArray ());
					}
					break;
				case MJCP.Expression.Operation.@false :
					result = SLE.Expression.False ();
					break;
				case MJCP.Expression.Operation.@true :
					result = SLE.Expression.True ();
					break;
				case MJCP.Expression.Operation.Identifier :
						Identifier id = ((MJCP.IdentifierExpression)Input).ID;//TODO make a tree of variable and allow to get it 
						result = SLE.Expression.Read (builder.CreateVariable (GetSymbolId(id), SLE.Variable.VariableKind.Global, null));
						break;
				case MJCP.Expression.Operation.NumericLiteral :
					double val = 0;
					try {
						val = Double.Parse (((MJCP.NumericLiteralExpression)Input).Spelling);
						result = SLE.Expression.Constant (val);
					} catch {
						//TODO 
					}
					break;
				case MJCP.Expression.Operation.HexLiteral :
					result = SLE.Expression.Constant (((MJCP.HexLiteralExpression)Input).Value);
					break;
				case MJCP.Expression.Operation.OctalLiteral :
					result = SLE.Expression.Constant (((MJCP.OctalLiteralExpression)Input).Value);
					break;
				case MJCP.Expression.Operation.RegularExpressionLiteral :
					//TODO
					throw new NotImplementedException ();
				case MJCP.Expression.Operation.StringLiteral :
					result = SLE.Expression.Constant (((MJCP.StringLiteralExpression)Input).Value);
					break;
				case MJCP.Expression.Operation.ArrayLiteral :
					arguments = new List<SLE.Expression> ();
					
					arguments.Add (SLE.Expression.CodeContext ());

					initializers =new List<SLE.Expression> ();
					foreach (MJCP.ExpressionListElement element in ((MJCP.ArrayLiteralExpression)Input).Elements)
							initializers.Add (Generate (element.Value));
					arguments.Add (SLE.Expression.NewArray (typeof (object []), initializers));

					result = SLE.Expression.Call (typeof (CompilerHelpers).GetMethod ("ConstructArrayFromArrayLiteral"), arguments.ToArray ());
					break;
				case MJCP.Expression.Operation.ObjectLiteral :
					arguments = new List<SLE.Expression> ();

					arguments.Add (SLE.Expression.CodeContext ());
					
					initializers = new List<SLE.Expression> ();
					List<SLE.Expression> initializers2 = new List<SLE.Expression> ();
					foreach (MJCP.ObjectLiteralElement element in ((MJCP.ObjectLiteralExpression)Input).Elements) {
						initializers.Add (Generate (element.Name));
						initializers2.Add (Generate (element.Value));
					}
					arguments.Add (SLE.Expression.NewArray (typeof (object[]), initializers));
					arguments.Add (SLE.Expression.NewArray (typeof (object[]), initializers2));

					result = SLE.Expression.Call (typeof (CompilerHelpers).GetMethod ("ConstructObjectFromLiteral"), arguments.ToArray ());
					break;
				case MJCP.Expression.Operation.Parenthesized :
					result = Generate (((MJCP.UnaryOperatorExpression)Input).Operand); 
					break;
				case MJCP.Expression.Operation.Invocation :
					arguments = new List<SLE.Expression> ();
					//TODO fill arguments
					//args = new List<SLE.Arg> ();
					foreach (MJCP.ExpressionListElement element in ((MJCP.InvocationExpression)Input).Arguments.Arguments)
						arguments.Add (Generate (element.Value));
					
					SLE.Expression instance = Generate (((MJCP.InvocationExpression)Input).Target);
					//(Expression instance,) MethodInfo method, params Expression[] arguments
					//TODO MethodInfo!
					result = SLE.Expression.Call (instance, null, arguments.ToArray ());
					break;
				case MJCP.Expression.Operation.Subscript :
					arguments = new List<SLE.Expression> ();
					//TODO fill arguments and type result
					result = SLE.Expression.Action.Operator (MSO.GetItem, null, arguments.ToArray());
					break;
				case MJCP.Expression.Operation.Qualified :
					arguments = new List<SLE.Expression> ();
					//TODO fill arguments and type result
					result = SLE.Expression.Action.GetMember (GetSymbolId (((MJCP.QualifiedExpression)Input).Qualifier), null, arguments.ToArray());
					break;
				case MJCP.Expression.Operation.@new :
					SLE.Expression constructor = Generate (((MJCP.InvocationExpression)Input).Target);
					arguments = new List<SLE.Expression> ();
					foreach (MJCP.ExpressionListElement element in ((MJCP.InvocationExpression)Input).Arguments.Arguments)
						arguments.Add (Generate(element.Value));
					//todo fill the type result
					result = SLE.Expression.Action.Create (null, arguments.ToArray());
					break;
				case MJCP.Expression.Operation.Function :
					result = GenerateFunction (((MJCP.FunctionExpression)Input).Function);
					//the statement and expression is not the same
					result = SLE.Expression.Assign (GetVar (((MJCP.FunctionExpression)Input).Function.Name), result);
					break;
				case MJCP.Expression.Operation.delete :
					arguments = new List<SLE.Expression> ();
					//TODO fill arguments
					result = SLE.Expression.Call (typeof (CompilerHelpers).GetMethod ("Delete"), arguments.ToArray ());
					break;
				case MJCP.Expression.Operation.@void :
					arguments = new List<SLE.Expression> ();
					//TODO fill arguments
					result = SLE.Expression.Call (typeof (CompilerHelpers).GetMethod ("Void"), arguments.ToArray ());
					break;
				case MJCP.Expression.Operation.@typeof :
					arguments = new List<SLE.Expression> ();
					//TODO fill arguments
					result = SLE.Expression.Call (typeof (CompilerHelpers).GetMethod ("TypeOf"), arguments.ToArray ());
					break;
				case MJCP.Expression.Operation.PrefixPlusPlus :
					//
					break;
				case MJCP.Expression.Operation.PrefixMinusMinus :
					//
					break;
				case MJCP.Expression.Operation.PrefixPlus :
					arguments = new List<SLE.Expression> ();
					//TODO fill arguments
					result = SLE.Expression.Call (typeof (CompilerHelpers).GetMethod ("Positive"), arguments.ToArray());
					break;
				case MJCP.Expression.Operation.PrefixMinus :
					arguments = new List<SLE.Expression> ();
					//TODO fill arguments
					result = SLE.Expression.Call (typeof (CompilerHelpers).GetMethod ("Negate"), arguments.ToArray());
					break;
				case MJCP.Expression.Operation.Tilda :
					arguments = new List<SLE.Expression> ();
					//TODO fill arguments
					result = SLE.Expression.Call (typeof (CompilerHelpers).GetMethod ("OnesComplement"), arguments.ToArray());
					break;
				case MJCP.Expression.Operation.Bang :
					arguments = new List<SLE.Expression> ();
					//TODO fill arguments
					result = SLE.Expression.Call (typeof (CompilerHelpers).GetMethod ("Not"), arguments.ToArray());
					break;
				case MJCP.Expression.Operation.PostfixPlusPlus :
					//TODO
					break;
				case MJCP.Expression.Operation.PostfixMinusMinus :
					MJCP.UnaryOperatorExpression expr = (MJCP.UnaryOperatorExpression)Input;
					//TODO
					break;
				case MJCP.Expression.Operation.Comma :
					binOp = (MJCP.BinaryOperatorExpression)Input;
					arguments = new List<SLE.Expression> ();
					arguments.Add (Generate (binOp.Left));
					arguments.Add (Generate (binOp.Right));
					result = SLE.Expression.Comma (arguments);
					break;
				case MJCP.Expression.Operation.Equal :
					binOp = (MJCP.BinaryOperatorExpression)Input;
					result = GenerateBoundAssignment (binOp.Left, binOp.Right);
					break;
				case MJCP.Expression.Operation.StarEqual :
					binOp = (MJCP.BinaryOperatorExpression)Input;
					right = SLE.Expression.Multiply (Generate(binOp.Left), Generate(binOp.Right));
					result = GenerateBoundAssignment (binOp.Left, right);
					break;
				case MJCP.Expression.Operation.DivideEqual :
					binOp = (MJCP.BinaryOperatorExpression)Input;
					right = SLE.Expression.Multiply (Generate(binOp.Left), Generate(binOp.Right));
					result = GenerateBoundAssignment (binOp.Left, right);
					break;
				case MJCP.Expression.Operation.PercentEqual :
					binOp = (MJCP.BinaryOperatorExpression)Input;
					right = SLE.Expression.Modulo (Generate(binOp.Left), Generate(binOp.Right));
					result = GenerateBoundAssignment (binOp.Left, right);
					break;
				case MJCP.Expression.Operation.PlusEqual :
					binOp = (MJCP.BinaryOperatorExpression)Input;
					right = SLE.Expression.Add (Generate(binOp.Left), Generate(binOp.Right));
					result = GenerateBoundAssignment (binOp.Left, right);
					break;
				case MJCP.Expression.Operation.MinusEqual:
					binOp = (MJCP.BinaryOperatorExpression)Input;
					right = SLE.Expression.Subtract (Generate(binOp.Left), Generate(binOp.Right));
					result = GenerateBoundAssignment (binOp.Left, right);
					break;
				case MJCP.Expression.Operation.LessLessEqual:
					binOp = (MJCP.BinaryOperatorExpression)Input;
					right = SLE.Expression.LeftShift (Generate(binOp.Left), Generate(binOp.Right));
					result = GenerateBoundAssignment (binOp.Left, right);
					break;
				case MJCP.Expression.Operation.GreaterGreaterEqual:
					binOp = (MJCP.BinaryOperatorExpression)Input;
					right = SLE.Expression.RightShift (Generate(binOp.Left), Generate(binOp.Right));
					result = GenerateBoundAssignment (binOp.Left, right);
					break;
				case MJCP.Expression.Operation.GreaterGreaterGreaterEqual:
					binOp = (MJCP.BinaryOperatorExpression)Input;//TODO right shift unsigned
					right = SLE.Expression.RightShift (Generate(binOp.Left), Generate(binOp.Right));
					result = GenerateBoundAssignment (binOp.Left, right);
					break;
				case MJCP.Expression.Operation.AmpersandEqual:
					binOp = (MJCP.BinaryOperatorExpression)Input;
					right = SLE.Expression.And (Generate(binOp.Left), Generate(binOp.Right));
					result = GenerateBoundAssignment (binOp.Left, right);
					break;
				case MJCP.Expression.Operation.CircumflexEqual:
					binOp = (MJCP.BinaryOperatorExpression)Input;
					right = SLE.Expression.ExclusiveOr (Generate(binOp.Left), Generate(binOp.Right));
					result = GenerateBoundAssignment (binOp.Left, right);
					break;
				case MJCP.Expression.Operation.BarEqual:
					binOp = (MJCP.BinaryOperatorExpression)Input;
					right = SLE.Expression.Or (Generate(binOp.Left), Generate(binOp.Right));
					result = GenerateBoundAssignment (binOp.Left, right);
					break;
				case MJCP.Expression.Operation.BarBar :
					result = SLE.Expression.OrElse (Generate (((MJCP.BinaryOperatorExpression)Input).Left), Generate (((MJCP.BinaryOperatorExpression)Input).Right));
					break;
				case MJCP.Expression.Operation.AmpersandAmpersand :
					result = SLE.Expression.AndAlso (Generate (((MJCP.BinaryOperatorExpression)Input).Left), Generate (((MJCP.BinaryOperatorExpression)Input).Right));
					break;
				case MJCP.Expression.Operation.Bar:
					binOp = (MJCP.BinaryOperatorExpression)Input;
					result = SLE.Expression.Or (Generate(binOp.Left), Generate(binOp.Right));
					break;
				case MJCP.Expression.Operation.Circumflex:
					binOp = (MJCP.BinaryOperatorExpression)Input;
					result = SLE.Expression.ExclusiveOr (Generate(binOp.Left), Generate(binOp.Right));
					break;
				case MJCP.Expression.Operation.Ampersand:
					binOp = (MJCP.BinaryOperatorExpression)Input;
					result = SLE.Expression.And (Generate(binOp.Left), Generate(binOp.Right));
					break;
				case MJCP.Expression.Operation.EqualEqual:
					binOp = (MJCP.BinaryOperatorExpression)Input;
					result = SLE.Expression.Equal (Generate(binOp.Left), Generate(binOp.Right));
					break;
				case MJCP.Expression.Operation.BangEqual:
					binOp = (MJCP.BinaryOperatorExpression)Input;
					result = SLE.Expression.NotEqual (Generate(binOp.Left), Generate(binOp.Right));
					break;
				case MJCP.Expression.Operation.EqualEqualEqual:
					arguments = new List<SLE.Expression> ();
					//TODO fill arguments
					result = SLE.Expression.Call (typeof (CompilerHelpers).GetMethod ("Is"), arguments.ToArray());
					break;
				case MJCP.Expression.Operation.BangEqualEqual:
					arguments = new List<SLE.Expression> ();
					//TODO fill arguments
					result = SLE.Expression.Call (typeof (CompilerHelpers).GetMethod ("IsNot"), arguments.ToArray());
					break;
				case MJCP.Expression.Operation.Less:
					binOp = (MJCP.BinaryOperatorExpression)Input;
					result = SLE.Expression.LessThan (Generate(binOp.Left), Generate(binOp.Right));
					break;
				case MJCP.Expression.Operation.Greater:
					binOp = (MJCP.BinaryOperatorExpression)Input;
					result = SLE.Expression.GreaterThan (Generate(binOp.Left), Generate(binOp.Right));
					break;
				case MJCP.Expression.Operation.LessEqual:
					binOp = (MJCP.BinaryOperatorExpression)Input;
					result = SLE.Expression.LessThanEquals (Generate(binOp.Left), Generate(binOp.Right));
					break;
				case MJCP.Expression.Operation.GreaterEqual:
					binOp = (MJCP.BinaryOperatorExpression)Input;
					result = SLE.Expression.GreaterThanEquals (Generate(binOp.Left), Generate(binOp.Right));
					break;
				case MJCP.Expression.Operation.instanceof:
					arguments = new List<SLE.Expression> ();
					//TODO fill arguments
					result = SLE.Expression.Call (typeof (CompilerHelpers).GetMethod ("InstanceOf"), arguments.ToArray());
					break;
				case MJCP.Expression.Operation.@in:
					arguments = new List<SLE.Expression> ();
					//TODO fill arguments
					result = SLE.Expression.Call (typeof (CompilerHelpers).GetMethod ("In"), arguments.ToArray());
					break;
				case MJCP.Expression.Operation.LessLess:
					binOp = (MJCP.BinaryOperatorExpression)Input;
					result = SLE.Expression.LeftShift (Generate(binOp.Left), Generate(binOp.Right));
					break;
				case MJCP.Expression.Operation.GreaterGreater:
					binOp = (MJCP.BinaryOperatorExpression)Input;
					result = SLE.Expression.RightShift (Generate(binOp.Left), Generate(binOp.Right));
					break;
				case MJCP.Expression.Operation.GreaterGreaterGreater:
					arguments = new List<SLE.Expression> ();
					arguments.Add (Generate (((MJCP.BinaryOperatorExpression)Input).Left));
					arguments.Add (Generate (((MJCP.BinaryOperatorExpression)Input).Right));
					//TODO type result
					result = SLE.Expression.Action.Operator (MSO.RightShiftUnsigned, null, arguments.ToArray());
					break;
				case MJCP.Expression.Operation.Plus:
					binOp = (MJCP.BinaryOperatorExpression)Input;
					result = SLE.Expression.Add (Generate(binOp.Left), Generate(binOp.Right));
					break;
				case MJCP.Expression.Operation.Minus:
					binOp = (MJCP.BinaryOperatorExpression)Input;
					result = SLE.Expression.Subtract (Generate(binOp.Left), Generate(binOp.Right));
					break;
				case MJCP.Expression.Operation.Star:
					binOp = (MJCP.BinaryOperatorExpression)Input;
					result = SLE.Expression.Multiply (Generate(binOp.Left), Generate(binOp.Right));
					break;
				case MJCP.Expression.Operation.Divide:
					binOp = (MJCP.BinaryOperatorExpression)Input;
					result = SLE.Expression.Divide (Generate(binOp.Left), Generate(binOp.Right));
					break;
				case MJCP.Expression.Operation.Percent:
					binOp = (MJCP.BinaryOperatorExpression)Input;
					result = SLE.Expression.Modulo (Generate(binOp.Left), Generate(binOp.Right));
					break;
				case MJCP.Expression.Operation.Question:
					result = SLE.Expression.Condition (Generate (((MJCP.TernaryOperatorExpression)Input).First),
						Generate (((MJCP.TernaryOperatorExpression)Input).Second),
						Generate (((MJCP.TernaryOperatorExpression)Input).Third));
					break;
				case MJCP.Expression.Operation.@null:
					result = SLE.Expression.Null ();
					break;
			}
			//seems to have disappear now
			//result.SetLoc (GetRowanTextSpan (Input.Location));
			return result;
		}