grammar

Combine free-form dictation and semantic in a srgs grammar

只谈情不闲聊 提交于 2019-12-01 14:11:54
I'm trying to combine both the result of a semantic and a dictation request in the semantic value of a SRGS document. For example, I would say "Search potato" and the output would be something like out="Search Potato" where Potato is a random word spoken by the user. I tought about using the garbage special rule, but it doesn't seem to work. So far that's what I have : <rule id="rule1" scope="public"> <one-of> <item xml:lang="en-us">Search</item> <item>Cherche</item> </one-of> <tag>out.command="Search"</tag> <tag>out.param1=<ruleref special="GARBAGE"/></tag> <tag>out=out.command+out.param1;<

Missing grammar in JBoss Resteasy generated WADL

北城余情 提交于 2019-12-01 12:07:00
I managed to get a WADL by using the org.jboss.resteasy.wadl.ResteasyWadlServlet ( https://stackoverflow.com/a/41471710/2528609 ), but the WADL does not contain the Grammar. The representation nodes also do not contain an element attribute defining the response type. Given the following rest endpoint class import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; @Path("user") public class UserEndpoint { @GET @Path("") @Produces(MediaType.APPLICATION_JSON) public UserResponse getUser() { UserResponse

shift/reduce Error with Cup

做~自己de王妃 提交于 2019-12-01 11:51:58
问题 Hi i am writing a Parser for a Programming language my university uses, with jflex and Cup I started with just the first basic structures such as Processes an Variable Declarations. I get the following Errors Warning : *** Shift/Reduce conflict found in state #4 between vardecls ::= (*) and vardecl ::= (*) IDENT COLON vartyp SEMI and vardecl ::= (*) IDENT COLON vartyp EQEQ INT SEMI under symbol IDENT Resolved in favor of shifting. Warning : *** Shift/Reduce conflict found in state #2 between

Writing XSS Filter for (X)HTML Based on White List

混江龙づ霸主 提交于 2019-12-01 09:29:20
I need to implement a simple and efficient XSS Filter in C++ for CppCMS . I can't use existing high quality filters written in PHP because because it is high performance framework that uses C++. The basic idea is provide a filter that have a while list of HTML tags and a white list of options for these tags. For example. typical HTML input can consist of <b> , <i> , tags and <a> tag with href . But straightforward implementation is not good enough, because, even allowed simple links may include XSS: <a href="javascript:alert('XSS')">Click On Me</a> There are many other examples can be found

Is it easier to write a recursive-descent parser using an EBNF or a BNF?

自作多情 提交于 2019-12-01 08:29:07
I've got a BNF and EBNF for a grammar. The BNF is obviously more verbose. I have a fairly good idea as far as using the BNF to build a recursive-descent parser; there are many resources for this. I am having trouble finding resources to convert an EBNF to a recursive-descent parser. Is this because it's more difficult? I recall from my CS theory classes that we went over EBNFs, but we didn't go over converting them into a recursive-descent parser. We did go over converting BNF's into a recursive-descent parser. The reason I'm asking is because the EBNF is more compact. From looking at the EBNF

Where can I find a yacc grammar for ECMAscript/Actionscript/Javascript [closed]

回眸只為那壹抹淺笑 提交于 2019-12-01 08:04:53
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 7 years ago . My compilers class requires us to find a yacc grammar for one of these languages and combine it with the tokenizer we wrote. Presumably this is something easy to Google but I can't find it and my classmates are

How does the JLS grammar match simple field accesses (obj.f)?

僤鯓⒐⒋嵵緔 提交于 2019-12-01 07:12:57
I was looking at the JLS Chapter 19 grammar trying to figure out how a simple field access is parsed: obj.field It looks to me like the first variant of the FieldAccess production is probably involved FieldAccess : Primary . Identifier super . Identifier TypeName . super . Identifier and that Primary should then be involved in parsing the obj part. Primary doesn't seem to be involved with parsing a simple reference like ExpressionName . That seems to be reached via PostfixExpression . PostfixExpression : Primary ExpressionName PostIncrementExpression PostDecrementExpression and, AFAICT,

Is it easier to write a recursive-descent parser using an EBNF or a BNF?

心已入冬 提交于 2019-12-01 06:46:15
问题 I've got a BNF and EBNF for a grammar. The BNF is obviously more verbose. I have a fairly good idea as far as using the BNF to build a recursive-descent parser; there are many resources for this. I am having trouble finding resources to convert an EBNF to a recursive-descent parser. Is this because it's more difficult? I recall from my CS theory classes that we went over EBNFs, but we didn't go over converting them into a recursive-descent parser. We did go over converting BNF's into a

Is there a way or an algorithm to convert DCG into normal definite clauses in Prolog?

别等时光非礼了梦想. 提交于 2019-12-01 06:06:51
I am a newbie in Prolog, and I am trying to understand how a grammar can be translated into a normal definite clause from a DCG. I understood that DCG notation is just syntactic sugar for normal definite clauses in Prolog. I started to depict some similarities between the normal definite grammars, and the DCGs, but failed to apply the same pattern, so I am asking is there some rules that I am missing or an algorithm of conversion that might work. Here is the grammar that I am working on, and here is what I did in order to translate that grammar: expr --> term, addterm. addterm --> []. addterm

ANTLR Is it possible to make grammar with embed grammar inside?

折月煮酒 提交于 2019-12-01 06:03:46
ANTLR: Is it possible to make grammar with embed grammar (with it's own lexer) inside? For example in my language I have ability to use embed SQL language: var Query = [select * from table]; with Query do something ....; Is it possible with ANTLR? Is it possible to make grammar with embed grammar (with it's own lexer) inside? If you mean whether it is possible to define two languages in a single grammar (using separate lexers), then the answer is: no, that's not possible. However, if the question is whether it is possible to parse two languages into a single AST, then the answer is: yes, it is