dsl

Is there a Harel Statechart DSL tool for Java?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-21 12:19:01
问题 I'm looking for a tool that understands a DSL in which I can define my statechart that generates Java code or where the statechart in the DSL is runnable as is. The tool would ideally be written in Java and must support superstates and orthogonal regions by definition of Harel Statecharts (or equivalently UML 2 State Machines). Alternatively, what would be the best library or tool to write such a DSL with? 回答1: Yakindu looks good: http://www.statecharts.org Harel Statecharts Visual Language

Genetic Programming in Haskell

[亡魂溺海] 提交于 2019-12-21 05:18:16
问题 There is GenProg (http://hackage.haskell.org/package/genprog) for example, but that only deals with numerical optimization, in this case finding an equation that describes the data. But I require for loops, if statements, when statements, Boolean checks etc. I need to be able to generate imperative structures. Any thought on this? My best options so far seem to be husk-scheme where I can run Scheme code as a DSL in Haskell. Surely there must be better ways? 回答1: If you're looking for

Use literal operators (eg “and”, “or”) in Groovy expressions?

别来无恙 提交于 2019-12-21 05:09:13
问题 My current work project allows user-provided expressions to be evaluated in specific contexts, as a way for them to extend and influence the workflow. These expressions the usual logical ones f. To make it a bit palatable for non-programmers, I'd like to give them the option of using literal operators (e.g. and, or, not instead of &, |, !). A simple search & replace is not sufficient, as the data might contains those words within quotes and building a parser, while doable, may not be the most

log4j in grails : how to log into file?

孤街浪徒 提交于 2019-12-21 04:37:14
问题 I have this log4j configuration in my grails config.groovy log4j = { error 'org.codehaus.groovy.grails.web.servlet', // controllers 'org.codehaus.groovy.grails.web.pages' // GSP warn 'org.mortbay.log' appenders { rollingFile name:'infoLog', file:'info.log', threshold: org.apache.log4j.Level.INFO, maxFileSize:1024 rollingFile name:'warnLog', file:'warn.log', threshold: org.apache.log4j.Level.WARN, maxFileSize:1024 rollingFile name:'errorLog', file:'error.log', threshold: org.apache.log4j.Level

Future of the with-statement in Javascript

自闭症网瘾萝莉.ら 提交于 2019-12-21 01:16:14
问题 I know that usage of the with -statement is not recommended in Javascript and is forbidden in ECMAScript 5, but it allows one to create some nice DSLs in Javascript. For example CoffeeKup-templating engine and the Zappa web DSL. Those uses some very weird scoping methods with the with -statement to achieve DSLish feeling to them. Is there any future with the with -statement and these kinds of DSLs? Can this DSL-effect be achieved without the with -statement? 回答1: with being "forbidden" in

Simplfying DSL written for a C# app with IronPython

旧城冷巷雨未停 提交于 2019-12-20 12:34:37
问题 Thanks to suggestions from a previous question, I'm busy trying out IronPython, IronRuby and Boo to create a DSL for my C# app. Step one is IronPython, due to the larger user and knowledge base. If I can get something to work well here, I can just stop. Here is my problem: I want my IronPython script to have access to the functions in a class called Lib. Right now I can add the assembly to the IronPython runtime and import the class by executing the statement in the scope I created: // load

Compile and execute Scala code at runtime

馋奶兔 提交于 2019-12-20 12:07:37
问题 Is is possible to compile and execute scala code as a string at runtime either in Scala or in Java? My idea is to build a DSL using Scala then let Java programmers use the DSL inside Java. I heard that the class scala.tools.nsc.Interpreter can do something like that, but when I imported it inside my scala file, I got "object tools is not a member of package scala." So could anybody give me a hint? 回答1: In 2.10.0 we expose Scala reflection API, which among everything else includes a runtime

What are the main differences between Jetbrains' MPS and Eclipse Xtext?

断了今生、忘了曾经 提交于 2019-12-20 08:24:03
问题 I have used Eclipse Xtext in several projects. I loved the ease of defining a grammar over an Ecore (meta)model and letting everything generated for you including awesome Eclipse plugin editor, but I was quite uncomfortable with the underlying EMF framework with everything hard-wired in static fields. Lately I came across Jetbrains' MPS (Meta Programming System). It's based on completely different philosophy. While Xtext is for creating text-based DSLs generating a parser for you (and

Kotlin - Restrict extension method scope

余生长醉 提交于 2019-12-19 03:39:07
问题 Is there a way to restrict extension methods in DSLs? Say I have a class structure like this: class Outer { fun middle(op: Middle.() -> Unit): Middle { val middle = Middle() middle.op() return middle } } class Middle { fun inner(op: Inner.() -> Unit): Inner { val inner = Inner() inner.op() return inner } } class Inner fun outer(op: Outer.() -> Unit): Outer { val outer = Outer() outer.op() return outer } I can then create a call like so: outer { middle { inner { middle { } // Here is the

Functional programming with dplyr

和自甴很熟 提交于 2019-12-18 15:52:22
问题 Looking for a more efficient / elegant way to pass multiple arguments to a group-by using non-standard evaluation in a function using dplyr. I don't want to use the ... operator, but to specify the functions individually. My specific use case is a function which takes a data frame and creates a ggplot object with simpler syntax. Here is an example of the code I want to automate with my function: # create data frame my_df <- data.frame(month = sample(1:12, 1000, replace = T), category = sample