dsl

Transform a GADT without constraints to another GADT with constraints when such constraints hold

♀尐吖头ヾ 提交于 2019-12-06 19:58:23
问题 Can we transform a GADT without a given constraint on its constructors to a GADT that does have the said constraint? I want to do this because I want to get a deep-embedding of Arrows and do some interesting things with the representation that (for now) seem to require Typeable . (One reason) data DSL a b where Id :: DSL a a Comp :: DSL b c -> DSL a b -> DSL a c -- Other constructors for Arrow(Loop,Apply,etc) data DSL2 a b where Id2 :: (Typeable a, Typeable b) => DSL2 a a Comp2 :: (Typeable a

Groovy DSL: creating dynamic closures from Strings

五迷三道 提交于 2019-12-06 14:39:22
There are some other questions on here that are similar but sufficiently different that I need to pose this as a fresh question: I have created an empty class, lets call it Test. It doesn't have any properties or methods. I then iterate through a map of key/value pairs, dynamically creating properties named for the key and containing the value... like so: def langMap = [:] langMap.put("Zero",0) langMap.put("One",1) langMap.put("Two",2) langMap.put("Three",3) langMap.put("Four",4) langMap.put("Five",5) langMap.put("Six",6) langMap.put("Seven",7) langMap.put("Eight",8) langMap.put("Nine",9)

How to join multiple queryDSL tables

谁说我不能喝 提交于 2019-12-06 07:10:26
I have some tables and I want to get result using queryDSL join, but haven't found any examples on multiple joins using queryDSL. I have these tables: Account table: accountId (PK) | email | password account_profile table: accountId (PK)(fk to account) | nickname Community table: articleId (PK) | accountId (fk to account) | title | content Now I want below JPQL to be queryDSL code select r from community r join r.account.profile a where a.nickname = :nickname I have entity metamodels - QAccount, QAccountProfile, QCommunity Additionally, I have to get the result with pagination, so the query

How GOTO statement in Groovy?

社会主义新天地 提交于 2019-12-06 06:49:48
问题 I saw this nice blog post about a Scala continuations that 'emulates' a GOTO statement in the Scala language. (read more about Continuations here) I would like to have the same in the programming language Groovy. I think it's possible within a Groovy compiler phase transformation. I'm working on an Domain-Specific Language (DSL), and preferred embedded in Groovy. I would like to have the GOTO statement, because the DSL is an unstructured language (and is generated from workflow diagrams). I

Code parser for own DSL in C# [closed]

自闭症网瘾萝莉.ら 提交于 2019-12-06 06:09:20
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 6 years ago . I'm looking for something like flex/bison that works with C# code. I want to be able to provide some language descriptors and a parser should be generated. There are several options. I've found Irony to be good. It's powerful, and it has

how to include groovy dsl script from one groovy file to another

南笙酒味 提交于 2019-12-06 05:39:04
I have created a custom dsl command chain using methods in a groovy scripts . I have a problem in accessing this command chain from another groovy file . Is there a way to achieve the functionality ? I have tried using "evaluate" which is able to load the groovy file , but it is not able to execute the command chain. I have tried using Groovy shell class , but was not able to call the methods. show = { def cube_root= it } cube_root = { Math.cbrt(it) } def please(action) { [the: { what -> [of: { n -> def cube_root=action(what(n)) println cube_root; }] }] } please show the cube_root of 1000 Here

Are Project-Specific DSLs a Liability? [closed]

吃可爱长大的小学妹 提交于 2019-12-06 03:38:38
问题 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 8 years ago . I've forked this question from a similar question I made in a comment I made to one of the many great answers I recieved. I was originally asking about AST macros, which mostly provoked very detailed and thoughtful responses from Lispers. Thanks. Lazy Evaluation vs Macros The question I made in a comment was

Need to process multiple files in parallel in Spring Integration

守給你的承諾、 提交于 2019-12-06 02:46:29
I have a SFTP directory and reading files and sending the files for further processing to a ServiceActivator.At any point I need to process them parallely using the handler. Here is my SPring Integration java DSL flow. IntegrationFlows.from(Sftp.inboundAdapter(getSftpSessionFactory()) .temporaryFileSuffix("COPY") .localDirectory(directory) .deleteRemoteFiles(false) .preserveTimestamp(true) .remoteDirectory("remoteDir")) .patternFilter("*.txt")), e -> e.poller(Pollers.fixedDelay(500).maxMessagesPerPoll(5))) .handle("mybean", "myMethod") .handle(Files.outboundAdapter(new File("success")))

Is there a way to match the content of a spirit::lex string token as a literal in a spirit::qi grammar

对着背影说爱祢 提交于 2019-12-05 20:49:34
I'm writing a DSL and using a Boost Spirit lexer to tokenize my input. In my grammar, I want a rule similar to this (where tok is the lexer): header_block = tok.name >> ':' >> tok.stringval > ';' >> tok.description >> ':' >> tok.stringval > ';' ; Rather than specifying reserved words for the language (e.g. "name", "description") and deal with synchronizing these between the lexer and grammar, I want to just tokenize everything that matches [a-zA-Z_]\w* as a single token type (e.g. tok.symbol ), and let the grammar sort it out. If I weren't using a lexer, I might do something like this:

Groovy override compareTo

删除回忆录丶 提交于 2019-12-05 17:04:48
I am working under DSL using Groovy categories and I need to override/overload == operator. It is however known issue , that when class implements Comparable , Groovy will call compareTo() method for == operator. I'm looking for some workaround (not AST transformation) in order to make == do exactly what I want. I have the following "toy" situation: class Base implements Comparable<Base>{ int a, b Base(int a, int b) { this.a = a this.b = b } @Override int compareTo(Base o) { return a <=> o.a //compare only a } } class BaseCategory { static boolean equals(Base base, o) { //complete equals if (o