Talk:Parse EBNF: Difference between revisions
(→ANTLR parser EBNF or ISO standard EBNF?: and ideas for a →Rewrite?: .) |
|||
Line 37: | Line 37: | ||
== PicoLisp grammar is PicoLisp not EBNF == |
== PicoLisp grammar is PicoLisp not EBNF == |
||
PicoLisp seems to parse PicoLisp rather than EBNF. This makes for a shorter program, but, if allowed, then the task description should state something like ''"parse an EBNF-like input grammer expressed as code for your programming language"'' to be fair. --[[User:Paddy3118|Paddy3118]] 05:05, 13 May 2011 (UTC) |
PicoLisp seems to parse PicoLisp rather than EBNF. This makes for a shorter program, but, if allowed, then the task description should state something like ''"parse an EBNF-like input grammer expressed as code for your programming language"'' to be fair. --[[User:Paddy3118|Paddy3118]] 05:05, 13 May 2011 (UTC) |
||
== ANTLR parser EBNF or ISO standard EBNF? == |
|||
There is a [http://www.cl.cam.ac.uk/~mgk25/iso-14977.pdf difference]. --[[User:Paddy3118|Paddy3118]] 05:43, 13 May 2011 (UTC) |
|||
== Rewrite?== |
|||
How about defining an EBNF-like language here and have the task be to: |
|||
# Parse a ''given'' language definition for a simple calculator that goes right down to terminals. |
|||
# Parse a given expression including numbers with all digits and traversing all edges in the language graph. |
|||
# Parse a modified language definition where NUMBERS do not include 6. |
|||
# Print and show that the earlier expression fails to parse. |
|||
--[[User:Paddy3118|Paddy3118]] 05:43, 13 May 2011 (UTC) |
Revision as of 05:43, 13 May 2011
I guess I started this as a draft task because I haven't implemented it myself yet.
There is no reason to keep it a draft too long if we get a few fresh implementations here. Tinku99 05:28, 12 June 2010 (UTC)tinku99
- Interesting. I usually create a task after having an implementation as it helps with the task description etc. --Paddy3118 10:31, 12 June 2010 (UTC)
The task wording is somewhat sloppy. A parser could be for a (EBNF) grammar, not (plural) grammars. For grammars there can be a parser generator. The existing examples in fact build a parser for a particular grammar, and they don't use EBNF at all. May be task should be renamed as "Simple calculator parser"?Avmich 20:30, 22 April 2011 (UTC)
EBNF parser or parser for the given EBNF grammar?
Is the task to write a parser that takes an EBNF grammar as input? That's how the task description sounds for me, but all implementation examples don't do this.. Or is the task to write a parser for the given EBNF grammar? Then the description should be clarified and the title changed. None of the examples parses the EBNF grammar. --Oenone 11:48, 10 May 2011 (UTC)
- Yes, the parser should take an EBNF grammar as input. The two examples (PicoLisp and Tcl) are wrong. I would keep the title "EBNF parser". --Kernigh 14:34, 11 May 2011 (UTC)
- If it needs to be an EBNF parser then we have a task description with no working language implementation after 11 months. Do we need a rule that tasks should have at least one correct implementation or at least some indication from the task creator, Tinku, that an implementation is correct after a reasonal amount of time - say - a week or two? Looking at this task, it seems to have been abandoned by Tinku without them OK'ing any of the implementations. --Paddy3118 16:44, 11 May 2011 (UTC)
- OK, this makes sense. In which format is the grammar supposed to be? Does it have to be plain text form, or could it also be e.g. in s-expressions, which would be the natural choice in case of PicoLisp.
- The task description links to at least two different EBNF formats. So I cannot know which format to use. I guess that all the solutions will use different formats? --Kernigh 01:02, 12 May 2011 (UTC)
- I think it should be plain text form, like http://en.wikipedia.org/wiki/EBNF --Oenone 08:24, 12 May 2011 (UTC)
Output form
What should the output of the parser be? The rules as supplied don't give any information about result, so strictly it can only be a recognizer… –Donal Fellows 14:33, 12 May 2011 (UTC)
- For the Ruby implementation, I intend to give error messages about syntax errors. --Kernigh 23:19, 12 May 2011 (UTC)
Is the example grammar correct?
The given calculator grammar uses the identifiers PLUS
, MINUS
, MULT
, DIV
, and NUMBER
without defining them. Don't they need to be defined? —Underscore (Talk) 20:54, 12 May 2011 (UTC)
- +1 on that. --Paddy3118 04:55, 13 May 2011 (UTC)
PicoLisp grammar is PicoLisp not EBNF
PicoLisp seems to parse PicoLisp rather than EBNF. This makes for a shorter program, but, if allowed, then the task description should state something like "parse an EBNF-like input grammer expressed as code for your programming language" to be fair. --Paddy3118 05:05, 13 May 2011 (UTC)
ANTLR parser EBNF or ISO standard EBNF?
There is a difference. --Paddy3118 05:43, 13 May 2011 (UTC)
Rewrite?
How about defining an EBNF-like language here and have the task be to:
- Parse a given language definition for a simple calculator that goes right down to terminals.
- Parse a given expression including numbers with all digits and traversing all edges in the language graph.
- Parse a modified language definition where NUMBERS do not include 6.
- Print and show that the earlier expression fails to parse.
--Paddy3118 05:43, 13 May 2011 (UTC)