grammar Questions
9
Is there a ready-to-use English grammar that I can just load it and use in NLTK? I've searched around examples of parsing with NLTK, but it seems like that I have to manually specify grammar ...
9
Solved
I'm studying for a finite automata & grammars test and I'm stuck with this question:
Construct a grammar that generates L:
L = {a^n b^m c^m+n|n>=0, m>=0}
I believe my productions shoul...
Geaghan asked 20/6, 2009 at 15:48
1
Solved
For a specific application, I do a GUI to manipulate some data (internally: numpy 1D arrays), and plot them.
The end-user can choose in the UI to plot various series a, b, c.
Now I also need to all...
4
I'm working on a problem (from Introduction to Automata Theory, Languages and Computer by Hopcroft, Motwani and Ullman) to write a regular expression that defines a language consisting of all strin...
Editheditha asked 17/4, 2010 at 9:53
3
Solved
I'm creating my first grammar with ANTLR and ANTLRWorks 2. I have mostly finished the grammar itself (it recognizes the code written in the described language and builds correct parse trees), but I...
Clinician asked 19/4, 2013 at 10:28
2
This is a typescript interface:
interface A {
l: { x: string; y:number }
}
But this (similar thing) produces an error:
interface A {
l: { x: string, y:number }
}
// => Error: ';' expected...
Palatable asked 16/1, 2015 at 23:10
1
Solved
I have written this - it works fine:
use Grammar::Tracer;
my grammar Lambda {
token TOP { <signature> <body> ' as ' <r-type> }
rule signature { '|' <a-sig> [',' <b-sig...
6
Solved
How to check whether a sentence is valid in Python?
Examples:
I love Stackoverflow - Correct
I Stackoverflow love - Incorrect
6
Solved
I'm very curious how assembly languages work- I remain general because I'm not talking only about intel x86 assembly (although it's the only one I'm remotely familiar with). To be a bit more clear....
2
I have an Xtext/Antlr grammar that parses a subset of coffeescript. I have some test cases, but I thought of doing another sort of test:
Generate random, syntactically correct snippets from my An...
Casady asked 12/12, 2011 at 17:32
2
I have problem generating my grammar defintion with antlr v4:
grammar TagExpression;
expr : not expr
| expr and expr
| expr or expr
| '(' expr ')'
| tag
;
tag : [a-zA-Z]+ ;
and : '&' ;
or ...
21
Solved
Maybe I am not from this planet, but it would seem to me that the following should be a syntax error:
int a[] = {1,2,}; //extra comma in the end
But it's not. I was surprised when this code compil...
Adulation asked 12/8, 2011 at 16:36
1
Solved
This is similar to this question for classes, except the same procedure does not seem to work for Grammars.
grammar TestGrammar {
token num { \d+ }
}
my $test-grammar = TestGrammar.new();
my $to...
Putsch asked 20/12, 2022 at 9:24
1
Solved
I'm getting back into language design/specification (via BNF/EBNF grammars) after 20+ years of leaving the topic alone (since my CS undergrad degree).
I only vaguely recall the various related term...
Tamworth asked 14/12, 2022 at 23:40
4
On page 74 of the ANTRL4 book it says that any Unicode character can be used in a grammar simply by specifying its codepoint in this manner:
'\uxxxx'
where xxxx is the hexadecimal value for the ...
1
Solved
Suppose grammar G has the following productions …
S → aSb | A | B
A → λ | a | aa | aaa
B → bB | b
Using grammar G, a derivation of the string aaaaabb is …
S ⇒ aSb ⇒ aaSbb ⇒ aaAbb ⇒ aaaaabb
I...
4
Solved
How can I convert some regular language to its equivalent Context Free Grammar?
Is it necessary to construct the DFA corresponding to that regular expression or is there some rule for such a conver...
2
Parsing a few hundreds files using my grammar using a plain
for @files -> $file {
my $input = $file.IO.slurp;
my $output = parse-and-convert($input);
$out-dir.IO.add($file ~ '.out').spurt: $o...
Castiron asked 13/8, 2022 at 14:56
1
Solved
If I have something like this in my grammar:
grammar G {
token tab-indent(Int $level) {
# Using just ** $level would require <!before \t> to have the same effect, so use a code block for si...
4
Solved
In the dragon book, LL grammar is defined as follows:
A grammar is LL if and only if for any production A -> a|b, the following two conditions apply.
FIRST(a) and FIRST(b) are disjoint. This ...
Periodic asked 23/4, 2013 at 9:8
1
Solved
Suppose I have a grammar with the following tokens
token paragraph {
(
|| <header>
|| <regular>
)
\n
}
token header { ^^ '---' '+'**1..5 ' ' \N+ }
token regular { \N+ }
The prob...
10
Solved
Is there a name meaning "not a singleton"?
3
Solved
In order to further my understanding of parsers and grammars, I'm searching for a (hopefully simple) example of a language that is LL(2) but not LL(1). That is, a language that can be generated by ...
1
Solved
Suppose grammar G has two productions …
S → λ
S → aSb
In Raku, how would one create this grammar programmatically (i.e., dynamically, at runtime)?
The goal is to have a Raku program create — at...
1
Solved
If I do:
my $parsed_grammar = PG.parse( $some_string );
Is there any way to to do something like the pseudo code below?
$parsed_grammar.run_action( $action_class.new );
1 Next >
© 2022 - 2024 — McMap. All rights reserved.