problem about dsl-Collection of common programming errors


  • Jonas
    scala interpreter dsl
    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?

  • Mechanical snail
    scala syntax dsl syntactic-sugar
    Is it possible to have angle brackets in method names , e.g. :class Foo(ind1:Int,ind2:Int){…} var v = new Foo(1,2) v(1) = 3 //updates ind1 v<1> = 4 //updates ind2The real situation is obviously more complicated than this!!I am trying to provide a convenient user interface.

  • Rodrigo
    scripting erlang dsl fsm
    I am planning a turn based game (a sort of board game), and the backend will probably be done in Erlang. The game logic part seems to be a fit for a hierarchical state machine, but I’m not sure about how to implement that in Erlang.Maybe I can spawn a separate process with each child fsm, not sure if this would work.Another option would be to embed a scripting language or create a DSL for this purpose.What do you think?Thanks.

  • Meir Goldenberg
    ping dsl disconnect
    I have a dual-boot machine: Windows 7 and Ubuntu 10.04. The computer is connected directly to the Baudtec modem by a LAN cable. The modem is connected to the phone jack. Under Windows, the internet works without any problems. Under Ubuntu, I set up by using pppoeconf and can get online without a problem. However, after some time (about 15-20 minutes, sometimes less), the internet stops working. That is, I cannot open any website. I can still “ping 8.8.8.8”, although “ping www.google.com” says “u

  • Michael
    c parsing dsl
    One of my programs accepts a commands (like kill foo) at runtime. Think of it as a little domain-specific language. Here are a few examples:kill kill client exitBut also, chained commands are allowed and whitespace is not significant before and after commands, so the following examples are also valid:kill ; say “that was fun”kill ; kill ; kill;I have currently implemented this with lex/yacc (flex/bison to be specific) and that caused a lot of headache. The lexer very much depends on the c

  • Philipp Claßen
    coffeescript dsl design-by-contract
    I consider design-by-contract an useful technique and want to apply it to my coffeescript code.There is contracts.coffee, which looks really nice (like Haskell):id :: (Num) -> Num id = (x) -> xDownside is that it is a language extension. I’m hesitating because I’m afraid to trade in trouble with tool support. (Am I too conservative?)Though it really looks great, I would prefer a library solution at the moment. For Ruby, I recently found contracts.ruby, which shares the same elegance but ha

  • neezer
    ruby-on-rails-3 capybara dsl minitest
    The readme for Capybara (see Using Capybara with MiniTest::Spec) says that I can do this if I include the module correctly, but it doesn’t give any illustrative examples of how… I’ve tried including the module like this:class MiniTest::Specinclude Capybara::DSL end… to no avail. I keep getting this error:<main>’: undefined methodfeature’ for main:Object (NoMethodError)How can I get it to work as it’s written in the commented-out code?spec/acceptance/api/reward_terms_spec.rb:require “#{

  • Alessandro Vermeulen
    haskell dsl gadt
    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 whereId :: DSL a aComp :: DSL b c -> DSL a b -> DSL a c– Other constructors for Arrow(Loop,Apply,etc)data DSL2 a b whereId2 :: (Typeable a, Typeable b) => DSL2 a aComp2

  • tibbe
    haskell dsl gadt
    In Type-Safe Observable Sharing in Haskell Andy Gill shows how to recover sharing that existed on the Haskell level, in a DSL. His solution is implemented in the data-reify package. Can this approach be modified to work with GADTs? For example, given this GADT:data Ast e whereIntLit :: Int -> Ast IntAdd :: Ast Int -> Ast Int -> Ast IntBoolLit :: Bool -> Ast BoolIfThenElse :: Ast Bool -> Ast e -> Ast e -> Ast eI’d like to recover sharing by transforming the above AST totype N

  • Chris Kuklewicz
    haskell metaprogramming dsl
    Quasiquotation as described in haskellwiki is shown mostly as useful tool for embedding other languages inside Haskell without messing around with string quotation.Question is: For Haskell itself, how easy it would be to put existing Haskell code through a quasiquoter for the purpose of just replacing tokens and passing the result over to ghc? Perhaps Template Haskell is key here?I have looked for code examples and didn’t find any. Some EDSLs can benefit from this ability by reducing the size of

  • mu is too short
    ruby parsing dsl treetop
    With the grammar defined as below, why I keep get error while try to access the val method of nodes created by rule key?The error message is(eval):168:in `val’: undefined local variable or method `key’ for #<Treetop::Runtime::SyntaxNode:0x00000101b1e160> (NameError)The grammar isgrammar Commandrule create_command’create’ space pair {def valpair.valend}endrule pairkey space? ‘=’ space? ‘”‘ value ‘”‘ {def val{ key.val => value.val }end}endrule key[A-Za-z_] [A-Za-z0-9_]* {def valkey.to_sym

  • user1201210
    java parsing antlr dsl antlrworks
    I am creating a parser using ANTLR 3.x that targets java. I have written both parser grammar (for creating Abstract Syntax Tree, AST) and Tree Grammar (for performing operations on AST). Finally, to test both grammar files, I have written a test file in Java.Have a look at the below code,protocol grammargrammar protocol; options {language = Java;output = AST; }tokens{ //imaginary tokens PROT; INITIALP; PROC; TRANSITIONS; } @header { import twoprocess.Configuration; package com.javadude.antlr3.x.

  • user1424119
    java apache-camel dsl
    I have route:from(SU_NAME).choice().when(STATUS_IS_OK).to(“xslt:xsl/RemoveNode.xsl”).split().tokenizeXML(“Event”, “Header”).to(XP_NAME).otherwise().dynamicRouter(method(router, “slip”)).end(); If I remove splitter I have everything working fine, but having it in my route gives me:java.lang.Error: Unresolved compilation problem: The method otherwise() is undefined for the type ExpressionNodeI need splitter to be part of the route, can you help me. I understand that there should be choise ChoiceD

  • iglvzx
    networking wireless-router dsl
    Router reconfigures PC’s and they can no longer access the internet via hardwired connection to DSL Modem. Hardware Information:Buffalo Wireless Router/access point, Model: WZR-HP-G300NH-AP DSL Modem: Generic (actually not sure of manufacture). Service Provider: TOT (Thailand) Laptop-1: Windows XP and Belkin PCMIA Network Card Laptop-2: Windows XP unknown network card & Wifi Laptop-3: Windows 7 unknown network card & WifiOutline of Problem/actions taken:After a recent power failure the

  • John J. Camilleri
    eclipse-plugin dsl xtext
    I’m developing an Eclipse Plugin with support for my DSL using the Xtext framework. When I try to open a file on my system with the matching file extension .gf – but which is not in my workspace – I get the following:0 [main] ERROR org.eclipse.xtext.ui.editor.CompoundXtextEditorCallback – Was configured with another client or not configured at all. java.lang.IllegalStateException: Was configured with another client or not configured at all.at org.eclipse.xtext.ui.editor.DirtyStateEditorSuppo

  • jharvalik
    cxf apache-camel dsl pojo
    I have problem with proper processing of this route. <camelContext xmlns=”http://camel.apache.org/schema/spring”><route id=”ws_entry” streamCache=”true” ><from uri=”cxf://http://localhost:8082/webservices/incident?serviceClass=org.apache.camel.example.reportincident.ReportIncidentEndpoint/><to uri=”file://target/inbox” /><to uri=”bean:incidentProcessor”/> </route>Processing of InputReportIncident/OutputReportIncident by FileProcessor throws following exception

  • nils petersohn
    groovy dsl
    i am developing a nice little DSL with Groovy.I really like the Command Expression with higher order functions. with little code i can do:timerange = from today to tomorrowthis is actually timerange = from(today).to(tomorrow)but now i would like to do something like this:difference = difference from today to tomorrowwhich should result in something like this:difference = difference(from(today).to(event.start))I always get the error: No such property: from for class: Script1.Here is a test class

  • Tristan
    scala jython dsl
    I’m evaluating languages for a computational oriented app that needs an easy embedded scripting language for end users. I have been thinking of using Scala as the main underlying language and Jython for the scripting interface. An appeal of Scala is that I can define methods such as :* for elementwise multiplication of a matrix object and use it with infix syntax a :* b. But :* is not a valid method name in Python. How does Jython deal with this?I would consider using Scala as the scripting l