4
I Use This!
Activity Not Available

News

Analyzed about 1 year ago. based on code collected about 1 year ago.
Posted almost 11 years ago by rivantsov
here's a fix - add the following to the grammar: var fromList = new NonTerminal("fromList"); var fromElem = new NonTerminal("fromElem"); var aliasedTable = new NonTerminal("aliasedTable"); var joinExpr = new ... [More] NonTerminal("joinExpr"); var joinKind = new NonTerminal("joinKind"); var outerOpt = new NonTerminal("outerOpt"); fromList.Rule = MakePlusRule(fromList, comma, fromElem); fromElem.Rule = aliasedTable | fromElem+joinExpr; joinExpr.Rule = joinKind + aliasedTable + ON + expression; aliasedTable.Rule = Id + aliasOpt; joinKind.Rule = ToTerm("JOIN") | ToTerm("INNER") + "JOIN" | "LEFT" + outerOpt + "JOIN" | "RIGHT" + outerOpt + "JOIN"; outerOpt.Rule = Empty | "OUTER"; and change the existing expression: fromClauseOpt.Rule = Empty | FROM + fromList; then aliases should work. I tested an example: -- testing operator precedence with various capitalization of OR,AND operators SELECT Name FROM Product x left outer join y on x.yId = y.Id where A oR B and C OR D + X * 5; [Less]
Posted almost 11 years ago by rivantsov
sorry for long silence, will try to get to your problem this weekend
Posted almost 11 years ago by rivantsov
just use any grammar in samples as starting point, and proceed step by step. But if you're serious, make sure you read a compiler construction book, and know things like LALR, scanner, parser, etc
Posted almost 11 years ago by NaxAlpha
Hi I want to learn about Irony to make a very simple language but i found no tutorial about Irony so will any one help me to construct a very simple language Will anyone help me
Posted almost 11 years ago by Jpmon1
Sure, I have updated the CSharpGrammar to what you will find at the link below: https://peter.codeplex.com/SourceControl/latest#trunk/src/Peter/Logic/IronyGrammers/CSharpGrammar.cs This updated version has the changes I mentioned above, but in ... [More] order to catch the error you will need to revert lines 47 and 48 back to using the 'TerminalFactory'. I then feed that exact file to the parser that has the same grammar above loaded. You will then see the error about the invalid char representation. I hope this helps! Jon [Less]
Posted almost 11 years ago by SteveHarveyUK
Morning Folks, Just trying to add table aliases to the existing SQL 89 sample as I noticed that they cause a parsing error. The following change seems to work, changing: Id.Rule = MakePlusRule(Id, dot, Id_simple); to: Id.Rule = ... [More] MakePlusRule(Id, dot, Id_simple) | Id + asOpt + Id_simple; in the SqlGrammer.cs file. However this leaves me with the following Grammar errors: Shift-reduce conflict. State S59, lookahead [AS]. Selected shift as preferred action. Reduce-reduce conflict. State S59, lookaheads: id_simple. Selected reduce on first production in conflict set. Shift-reduce conflict. State S154, lookahead [id_simple]. Selected shift as preferred action. How can I suppress these conflicts? [Less]
Posted almost 11 years ago by rivantsov
one more question, please. It appears that 'standard' c# char literal from TerminalFactory did not work for you. This might be some bug. Can you please share some details (what was input that failed), so I can spot the problem and fix it? thanks roman
Posted almost 11 years ago by Jpmon1
Sorry, I suppose I do know a bit more about the problem then I was giving you. The problem was not with parsing the code after the case, it was with parsing the char '\u2085'. When the parser got to that position it was throwing an error about an ... [More] invalid char, only expecting it to be one character. I fixed the problem though, instead of creating the CharLiteral object from: TerminalFactory.CreateCSharpChar ("CharLiteral") I used the following code, and it seems to work fine: new StringLiteral ("CharLiteral", "'", StringOptions.AllowsUEscapes); Thanks for the quick reply though. [Less]
Posted almost 11 years ago by rivantsov
can you pls provide more details? inside this 'case' is just 'source.PreviewPosition++' - how this can fail? can you share your grammar?
Posted almost 11 years ago by Jpmon1
I am trying to update the C# grammar to the 4.0 syntax, and I am getting an error when Irony parses the C# grammar file when it is hitting line: case '\u2085': in the SkipWhitespace override method. I see when the code creating the char literal, is ... [More] going through some 'TerminalFactory'. How can I add support to the CharLiteral object for unicode characters? Thanks! [Less]