dsl

Using adaptive grammars [closed]

荒凉一梦 提交于 2019-12-18 12:30:17
问题 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 9 months ago . I'm trying to implement a language (or family of languages) whose grammar can be changed dynamically. I have found no examples that serve as study cases. Can you give me some reference to any that are actually used in the real world (even from the academic world)? Does it make sense to implement a Domain

DSLs (Domain Specific Languages) in Finance

£可爱£侵袭症+ 提交于 2019-12-18 10:12:36
问题 Has anyone worked with DSLs (Domain Specific Languages) in the finance domain? I am planning to introduce some kind of DSL support in the application that I am working on and would like to share some ideas. I am in a stage of identifying which are the most stable domain elements and selecting the features which would be better implemented with the DSL. I have not yet defined the syntax for this first feature. 回答1: Jay Fields and Obie Fernandez have written and talked extensively on the

When should I use a Domain Specific Language? [closed]

人盡茶涼 提交于 2019-12-18 10:09:23
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 6 months ago . I would like some practical guidance on when I should use a Domain Specific Language. I have found resources about advantages and disadvantages, but what kind of project would warrant its use? It seems like there is a big investment in time to create and maintain a DSL, so

'Spread' parameters in Scala?

左心房为你撑大大i 提交于 2019-12-17 20:23:28
问题 Is there any way to call a Scala function that takes individual parameters, given an array (similar to JavaScript Spreads in ECMAScript 6)? ys = [10.0, 2.72, -3.14] f(x, ...ys); The cleanest syntax would be: f(1, ys) but that does not appear to be possible. Even f(1, ys:_*) does not work (and neither does f(ys:_*) , as the compiler reports too few parameters - only the first one is filled). Example: def f (a:Int, b:Float, c:Float, d:Float): String val x = 1 val ys = List(10.0, 2.72, -3.14) //

Which Java oriented lexer parser for simple project (ANTLR, DIY, etc)

孤街醉人 提交于 2019-12-17 16:37:52
问题 I am working on a small text editor project and want to add basic syntax highlighting for a couple of languages (Java, XML..just to name a few). As a learning experience I wanted to add one of the popular or non popular Java lexer parser. What project do you recommend. Antlr is probably the most well known, but it seems pretty complex and heavy. Here are the option that I know of. Antlr Ragel (yes, it can generate Java source for processing input) Do it yourself (I guess I could write a

Can I define custom operator overloads in Javascript? [duplicate]

孤街浪徒 提交于 2019-12-17 10:58:45
问题 This question already has answers here : Javascript: operator overloading (5 answers) Overloading Arithmetic Operators in JavaScript? (11 answers) Closed 3 years ago . Is it possible to define custom operators between instances of a type in JavaScript? For example, given that I have a custom vector class, is it possible to use vect1 == vect2 to check for equality, whilst the underlying code would be something like this? operator ==(a, b) { return a.x == b.x && a.y == b.y && a.z == b.z; }

How to create a DSL Groovy config file using an arbitrary Map (dynamic object)

怎甘沉沦 提交于 2019-12-14 03:27:34
问题 How do I convert an arbitrary Groovy map / list to the config style DSL syntax that Groovy provides? Example: def config = [ 'test': 'lalala', 'nestedObject': [ foo1: 'foo1 val', foo2: 'foo2 val', nested2: [ anInt: 5, anArray: ['a', 'b', 'c'], anIntArray: [1, 2, 3] ] ] ] To something like: test = 'lalala' nestedObject { foo1 = 'foo1 val' foo2 = 'foo2 val' nested2 { anInt = 5 anArray = ['a', 'b', 'c'] anIntArray = [1, 2, 3] } } UPDATE: Re-appropriating this post to explicitly ask for a dynamic

Embedded scripting engine for DSL

寵の児 提交于 2019-12-14 01:16:14
问题 I'm working on a project which needs an embedded DSL to fullfill its expected requirements. The DSL would be user defined event based. Here goes a mockup of the desired syntax: user-defined-event-1 { // event body } user-defined-event-2 { // event body } Probably, most similar language I know based on events is LSL (from Second Life). So, after reading other similar questions on SO, I would like to ask for the best embeddable scripting engine (Ruby, Lua, Python, etc) on C++ (I work in Qt)

how to increment a message header

南笙酒味 提交于 2019-12-13 16:23:02
问题 Is there a way in Spring Integration Java DSL to modify an existing message header? I am reimplementing a download retry mechanism using SI Java DSL, and want to increment a message header holding the download attempts when a failure occurs, before routing the message based on the number of attempts compared to a limit. I have the routing working nicely based upon the RouterTests included with SI. With HeaderEnrichers I can easily add a header, but I can't see a way to modify an existing

What's the cleanest way to ignore empty nodes with Nokogiri::XML::Builder

夙愿已清 提交于 2019-12-13 15:33:08
问题 So let's say I have a builder template like the following: builder = Nokogiri::XML::Builder.new(:encoding => 'UTF-8') do |xml| xml.environment do |environment| environment.title title environment.feed feed environment.status status environment.description description # many many more end end builder.to_xml If feed and description were nil , it could output: <?xml version="1.0" encoding="UTF-8"?> <environment> <title>title</title> <feed/> <status>status</status> <description/> </environment> I