grammar Questions
4
Solved
I'm writing a simple functional programming language in Scala using the parser-combinators library.
The syntax is specified here: https://github.com/hejfelix/Frase/blob/master/src/main/scala/it/vi...
Pelag asked 31/10, 2015 at 10:14
2
Solved
Historically, LALR(1) parsers were preferred over LR(1) parsers because of resource requirements required by the large number of states generated by LR(1) parsers. It's hard to believe that this co...
Livvie asked 11/6, 2014 at 23:54
1
I am interested in writing micro-grammars. This is where the parser does not understand the full grammar of a language, only part of it; kind of "m4 on acid".
The idea is that the parser reads in ...
3
Solved
I am trying to parse a csv file to do simple things: extract last name, ID, and birthday, and change format of birthday from m/d/yyyy to yyyymmdd.
(1) I used named capture for birthdays, but it see...
Bahia asked 6/2, 2017 at 7:23
1
This is a Common Lisp data representation question.
What is a good way to represent grammars? By "good" I mean a representation that is simple, easy to understand, and I can operate on the represe...
Putrescine asked 23/3, 2016 at 22:1
6
There are so many programming languages which support the inclusion of mini-languages. PHP is embedded within HTML. XML can be embedded within JavaScript. Linq can be embedded within C#. Regular ex...
Domain asked 4/6, 2009 at 21:23
3
Here are two grammars. One uses a proto token and one doesn't. They both get the same done. These are basically the examples in S05 under "Variable (non-)interpolation". In this simple example, the...
3
Solved
Kotlin provides “semicolon inference”: syntactically, subsentences (e.g., statements, declarations etc) are separated by the pseudo-token SEMI, which stands for “semicolon or newline”. In most ca...
2
Solved
I have two questions. Is the behavior I show correct, and if so, is it documented somewhere?
I was playing with the grammar TOP method. Declared as a rule, it implies beginning- and end-of-string ...
1
Solved
In working with Prolog DCG to parse input it is nice to have an accompaning BNF of the grammar.
For example:
BNF
<Sentence> ::= <Noun_phrase> <Verb_phrase>
<Noun_phrase&g...
3
G'day!
How can I construct a simple ANTLR grammar handling multi-line expressions without the need for either semicolons or backslashes?
I'm trying to write a simple DSLs for expressions:
# sh ...
2
I am currently learning language processors and a topic that comes up very often is the direction in which elements in a grammar are consumed. Left to right or right to left.
I understand the conce...
Windywindzer asked 20/8, 2015 at 16:0
2
Solved
I have the following EBNF grammar for simple arithmetic expressions with left-associative operators:
expression:
term {+ term}
term:
factor {* factor}
factor:
number
( expression )
How can...
Aarau asked 11/7, 2012 at 12:50
5
Solved
Usually word lists are 1 file that contains everything, but are there separately downloadable noun list, verb list, adjective list, etc?
I need them for English specifically.
Savoyard asked 18/2, 2010 at 13:42
1
Solved
Abiword uses the link grammar parser as a simple grammar checker. I'd like to duplicate this feature with Python.
Poorly documented Python bindings exist, but I don't know how to use them to mimi...
Whole asked 23/7, 2016 at 19:33
0
I recently finished writing a recursive-descent parser for this LL(1) grammar (which generates a tiny subset of XML):
document ::= element EOF
element ::= < elementPrefix
elementPrefix ::= NAME...
Cheesy asked 24/10, 2016 at 20:37
1
Solved
I'm trying to write a compiler for C (simpler grammar though).
There is something that I've been stuck on for a while. If I understated correctly, all binary operations are left associative. So if ...
Questionnaire asked 19/10, 2016 at 21:56
1
Solved
I'm about to make a parser for a fictional subset of XML with the following EBNF grammar:
DOCUMENT ::= ELEMENT
ELEMENT ::= START_TAG (ELEMENT | DATA)* END_TAG | EMPTY_TAG
START_TAG ::= < NAME A...
Multiplicand asked 13/10, 2016 at 3:38
1
Solved
The compiler reminds me that I'm using a deleted function .
https://ideone.com/3YAIlA
#include <memory>
using namespace std;
class foo
{
public:
unique_ptr<int> p;
~foo()
{
}
};
i...
Averse asked 10/9, 2016 at 14:42
1
Solved
This question is inspired by Is sizeof(void()) a legal expression? but with an important difference as explained below.
The expression in question is:
sizeof( int() )
In the C++ grammar there a...
Salubrious asked 1/9, 2016 at 21:35
3
(Note: I've read other questions like this, but I haven't been able to figure this out).
I wrote this grammar:
start = call
ident = [a-z]+
spaces = [ ]+
call = f:ident spaces g:(call / ident) {...
1
I was trying to parse the function definition for the python language with PLY.
I am encountering issues related to the indentation.
For instance for a for statement, I would like to be able to kno...
Ziguard asked 4/11, 2013 at 17:55
3
Solved
Part of JavaScript's automatic semicolon insertion algorithm is so-called "restricted productions". These are syntactical forms which forbid a newline character from occurring at a certain point. T...
Dahle asked 11/7, 2016 at 15:57
2
Solved
I am mainly referring to the C++03 standard but, after a quick glance, it should also be applicable to the C++11 standard.
The following code compiled and executed successfully in VC++2010:
templ...
Millicentmillie asked 10/5, 2016 at 8:6
1
Choices
Typeclasses are brilliant in that they allow us to adjoin extra structure to existing types. Thereby allowing us to defer some design decisions rather than making rushed decision at the ti...
© 2022 - 2024 — McMap. All rights reserved.