bnf

Scala Parser Token Delimiter Problem

大城市里の小女人 提交于 2019-11-30 02:54:50
问题 I'm trying to define a grammar for the commands below. object ParserWorkshop { def main(args: Array[String]) = { ChoiceParser("todo link todo to database") ChoiceParser("todo link todo to database deadline: next tuesday context: app.model") } } The second command should be tokenized as: action = todo message = link todo to database properties = [deadline: next tuesday, context: app.model] When I run this input on the grammar defined below, I receive the following error message: [1.27] parsed:

Parser-generator that outputs C# given a BNF grammar? [closed]

空扰寡人 提交于 2019-11-29 04:18:56
I'm looking for a tool that will be able to build a parser (in C#) if I give it a BNF grammar (eg. http://savage.net.au/SQL/sql-2003-2.bnf ) Does such a generator exist? Normally BNF grammars are too ambiguous. ANTLR will be probably good for what you are looking for. The Visual Studio SDK actually ships with lexer and parser generation tools. These are called MPPG and MPLex and are part of the Managed Babel package. While the intention of bundling them with the SDK is to develop language extensions for Visual Studio, they are perfectly usable for creating general AST-emitting parsers. MPLex

Is there a formal (ideally BNF) typescript js language grammar (or only typescript subset)?

丶灬走出姿态 提交于 2019-11-29 02:53:41
问题 I'm looking for the Typescript grammar. Not the parser-lexer, but only the formal grammar description. I want to implement ts it's code folding and basic static code analyzing as plugin to one simple linux IDE for GNOME. 回答1: The formal grammar is in Appendix A of the TypeScript Language Reference, version 1.8 if which is found here or here (for current version) 回答2: Since typescript is a strict superset of Ecmascript 5 (http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262

A yacc shift/reduce conflict on an unambiguous grammar

大憨熊 提交于 2019-11-28 13:02:37
A piece of code of my gramamar its driveing me crazy. I have to write a grammar that allow write functions with multiple inputs e.g. function begin a: <statments> b: <statements> end The problem with that its that is statements that are assignments like this ID = Expresion. in the following quote you can see the output produced by yacc. 0 $accept : InstanciasFuncion $end 1 InstanciasFuncion : InstanciasFuncion InstanciaFuncion 2 | InstanciaFuncion 3 InstanciaFuncion : PuntoEntrada Sentencias 4 PuntoEntrada : ID ':' 5 Sentencias : Sentencias Sentencia 6 | Sentencia 7 Sentencia : ID '=' ID State

How to determine whether a language is LL(1) LR(0) SLR(1)

放肆的年华 提交于 2019-11-28 05:23:35
Is there a simple way to determine whether a grammar is LL(1), LR(0), SLR(1)... just from looking on the grammar without doing any complex analysis? For instance: To decide whether a BNF Grammar is LL(1) you have to calculate First and Follow sets - which can be time consuming in some cases. Has anybody got an idea how to do this faster? Any help would really be appreciated! First off, a bit of pedantry. You cannot determine whether a language is LL(1) from inspecting a grammar for it, you can only make statements about the grammar itself. It is perfectly possible to write non-LL(1) grammars

Converting EBNF to BNF

喜你入骨 提交于 2019-11-27 19:32:55
It's been a few years since my computer-language class and so I've forgotten the finer points of BNF's and EBNF's and I don't have a textbook next to me. Specifically, I've forgotten how to convert an EBNF into BNF. From what little I remember, I know that one of the main points is to convert { term } into <term> | <many-terms> . But I don't remember the other rules. I've tried to look this up online but I can only find links to either homework questions, or a small comment about converting terms with curly braces. I can't find an exhaustive list of rules that define the translation. 500 -

Regex Grammar

一曲冷凌霜 提交于 2019-11-27 18:49:03
Is there any BNF grammar for regular expression? VonC You can see one for Perl regexp (displayed a little more in detail here , as posted by edg ) To post them on-site: CMPT 384 Lecture Notes Robert D. Cameron November 29 - December 1, 1999 BNF Grammar of Regular Expressions Following the precedence rules given previously, a BNF grammar for Perl-style regular expressions can be constructed as follows. <RE> ::= <union> | <simple-RE> <union> ::= <RE> "|" <simple-RE> <simple-RE> ::= <concatenation> | <basic-RE> <concatenation> ::= <simple-RE> <basic-RE> <basic-RE> ::= <star> | <plus> |

Parser-generator that outputs C# given a BNF grammar? [closed]

老子叫甜甜 提交于 2019-11-27 18:07:18
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . I'm looking for a tool that will be able to build a parser (in C#) if I give it a BNF grammar (eg. http://savage.net.au/SQL/sql-2003-2.bnf) Does such a generator exist? 回答1: Normally BNF grammars are too ambiguous. ANTLR will be probably good for what you are looking for. 回答2: The Visual Studio SDK actually

Repository of BNF Grammars?

送分小仙女□ 提交于 2019-11-27 18:01:43
Is there a place I can find Backus–Naur Form or BNF grammars for popular languages? Whenever I do a search I don't turn up much, but I figure they must be published somewhere. I'm most interested in seeing one for Objective-C and maybe MySQL. Gene T you have to search on tools used to create grammars: "lex/yacc grammar", "antlr grammar" "railroad diagram" http://www.antlr3.org/grammar/list.html Here's some grammar files objective-c http://www.omnigroup.com/mailman/archive/macosx-dev/2001-March/022979.html http://www.cilinder.be/docs/next/NeXTStep/3.3/nd/Concepts/ObjectiveC/B_Grammar/Grammar

What is a regular language?

試著忘記壹切 提交于 2019-11-27 16:43:38
I'm trying to understand the concept of languages levels (regular, context free, context sensitive, etc.). I can look this up easily, but all explanations I find are a load of symbols and talk about sets . I have two questions: Can you describe in words what a regular language is, and how the languages differ? Where do people learn to understand this stuff? As I understand it, it is formal mathematics? I had a couple of courses at uni which used it and barely anyone understood it as the tutors just assumed we knew it. Where can I learn it and why are people "expected" to know it in so many