ebnf

Use existing languages in BNF with TinyPG?

浪子不回头ぞ 提交于 2019-12-03 21:42:49
How can I use these BNF grammars which are in GOLD meta-syntax (RegExp + BNF) with TinyPG? I'm new to BNF so approximately what sort of conversion will I have to do to convert BNF to EBNF? I believe it should be pretty simple since TinyPG needs RegExp + EBNF in comparison to the GOLD grammars which are RegExp + BNF . Also, is there any TinyPG source code for any language available, just to see what sort of conversion I would have to do? EBNF is not entirely backwards compatible with BNF, however the differences are actually slight, you should be familiar with the document at http://www.cs.cmu

Generate EBNF from ANTLR

荒凉一梦 提交于 2019-12-03 16:48:29
Anybody know of a tool, that generates EBNF from ANTLR? ANTLR is already close to EBNF, but for documentation purpose I would like to have a clean EBNF description (without the Code in between). With antlrworks and this its already nice to get the syntax diagrams: java -cp antlrworks-1.1.4.jar org.antlr.works.Console -f yql.g -o output/ -sd eps but it would like to have a bare textual description, preferable text, tex, html, xml, or similar. I have an online tool that converts foreign grammars to W3C grammar notation. It has an ANTLR3 grammar parser, so maybe this gets close to what you were

Grammar Writing Tools [closed]

只愿长相守 提交于 2019-12-03 09:26:52
问题 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 am trying to write a grammar in EBNF (barring a really good reason, it has to be EBNF) and am looking for a couple of utilities for it - if there's a GUI interface that can make one, that would be great, but the thing I'm looking for most is something that can check the grammar, for instance to see if it is

POSIX sh EBNF grammar

别等时光非礼了梦想. 提交于 2019-12-03 06:58:18
Is there an existing POSIX sh grammar available or do I have to figure it out from the specification directly? Note I'm not so much interested in a pure sh; an extended but conformant sh is also more than fine for my purposes. The POSIX standard defines the grammar for the POSIX shell. The definition includes an annotated Yacc grammar. As such, it can be converted to EBNF more or less mechanically. If you want a 'real' grammar, then you have to look harder. Choose your 'real shell' and find the source and work out what the grammar is from that. Note that EBNF is not used widely. It is of

Implementing parser for markdown-like language

别等时光非礼了梦想. 提交于 2019-12-03 03:16:19
I have markup language which is similar to markdown and the one used by SO. Legacy parser was based on regexes and was complete nightmare to maintain, so I've come up with my own solution based on EBNF grammar and implemented via mxTextTools/SimpleParse. However, there are issues with some tokens which may include each other, and I don't see a 'right' way to do it. Here is part of my grammar: newline := "\r\n"/"\n"/"\r" indent := ("\r\n"/"\n"/"\r"), [ \t] number := [0-9]+ whitespace := [ \t]+ symbol_mark := [*_>#`%] symbol_mark_noa := [_>#`%] symbol_mark_nou := [*>#`%] symbol_mark_nop := [*_>#

EBNF or BNF for the LOGO programming language

梦想与她 提交于 2019-12-03 02:23:54
Does anyone know where I can get the BNF or EBNF for the LOGO programming language? A BNF grammar might not be too useful in certain circumstances... Writing a LOGO that's accurately compatible with existing/historical implementation isn't an easy task (I worked on such a project). The problem is that the parser doesn't do the full job, and the evaluator (interpreter) has to work with partial data. Consider this example: proc1 a b proc2 c It could mean proc1(a, b, proc2(c)) or proc1(a, b, proc2(), c) according to the number of parameters for proc1 & proc2. Furthermore the LOGO interpreters I

Grammar Writing Tools [closed]

只谈情不闲聊 提交于 2019-12-02 23:47:59
I am trying to write a grammar in EBNF (barring a really good reason, it has to be EBNF) and am looking for a couple of utilities for it - if there's a GUI interface that can make one, that would be great, but the thing I'm looking for most is something that can check the grammar, for instance to see if it is LALR( n ), and if so, what the value of n is. Do such utilities exist? Are there any other useful grammar-writing tools I should know about (I'm not looking for parser generators). Taking Steven Dee's suggestion one step further, you might want to check out ANTLRWorks , which is an

ANTLRWorks debugging - the meaning of the different colors?

前提是你 提交于 2019-12-02 07:11:52
问题 I'm using the debugging mode of ANTLRWorks to test my c-grammar. Debugging in ANTLRWorks is really great for better understanding but I have a problem in understanding the different colors of the output tree. I'm using backtrack=true in my grammar. I thought that the red color means that the debugger goes the wrong way while green tells me that it is has gone the right way. But what about dark red and dark green? I added a picture of a "small tree" which only match the following input: int

What does the phrase “binds stronger” mean?

不羁的心 提交于 2019-12-02 00:19:07
I know this might be a newbie question, but I'm trying to make sense of this sentence(from a paper on a meta language that uses EBNF): Logical and (&) binds stronger than logical or (|). Before that it says: Conditions are: condition ::= condition (`&´ | `|´ ) condition | `!´ condition | relation relation ::= expression ( `=´ | `#´ | `<´ | `<=´ | `>´ | `>=´ ) expression thanks This refers to precedence . In other words, if you have A & B | C , you really have (A & B) | C . Operations with higher precedence/that bind stronger are evaluated first. 来源: https://stackoverflow.com/questions/16876455

Forth language EBNF rule for an infinite loop or if statement

青春壹個敷衍的年華 提交于 2019-12-02 00:07:14
问题 Is there an EBNF rule that describes a Forth infinite loop or if statement? 回答1: EBNF is used to describe syntax . A loop being infinite or otherwise wouldn't normally fall within what it would describe. As such, you'd be looking at the EBNF for an indefinite loop, which looks something like: indefinite_loop ::= 'BEGIN' statements cond 'UNTIL' Normally the cond will be something that pushes a 0 or 1 on the stack to determine whether to continue the loop ( 0 means continue the loop, 1 means