Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8042573
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T04:37:52+00:00 2026-06-05T04:37:52+00:00

I am trying to write a BASIC-like DSL using Groovy and I am at

  • 0

I am trying to write a BASIC-like DSL using Groovy and I am at a very early stage. I have a short script (ignore the package bit, I will refactor that away in due course):

package Binsic
PRINT "Hello World"

and this class:

package Binsic

abstract class BinsicInterpreter extends Script {

static def textArea

static def setTextArea(def window)
{
    textArea = window
}

def PRINT(def param) {
    textArea.append param
}

}

called in this way:

def engine = new BinsicEngine()
BinsicInterpreter.setTextArea(engine.binsicWindow.screenZX)
def conf = new CompilerConfiguration()
conf.setScriptBaseClass("BinsicInterpreter")
def shell = new GroovyShell(conf)
shell.evaluate(new File("./src/Binsic/test.bas"))

(BinsicEngine just sets the TextArea up at the moment)

This code fails…

org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
/Users/adrian/Documents/workspace-sts-2.9.1.RELEASE/BINSIC/src/Binsic/test.bas: 3: unexpected token: Hello World @ line 3, column 7.
PRINT “Hello World”
^

1 error

But if I change the statement to PRINT (“Hello World”) it works…

Similarly, I can get PRINT this to work (i.e. it prints the memory reference for this) if I adjust the PRINT code to handle non-strings. But no brackets are required.

Why won’t the unbracketed version work? And how can I fix this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T04:37:53+00:00Added an answer on June 5, 2026 at 4:37 am

    The problem is the upper-case PRINT – or upper-case first letter anything (such as Print).

    In Groovy, omitting parentheses is syntactical sugar to provide better DSL support. The compiler will have a set of rules on when it is allowed and when not.

    In my tests

    def Print(String arg) {
        println arg
    }
    def a = Print "Hello World"
    

    works, while

    def Print(String arg) {
        println arg
    }
    Print "Hello World"
    

    fails as you discovered. I suggest raising it as an issue on http://groovy.codehaus.org/.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I’m trying to write a basic ASP.NET form (using Visual Studio 2010) to submit
I'm trying to write a basic DST converter. I have a segmented control with
I'm trying to write a very basic macro in VB for Microsoft Word, but
I have a few basic questions about sockets programming. I am trying to write
Very new to working with Visual Basic / Excel. I am trying to write
I'm trying to write basic assert test: def assert_session_has ( sessionvar ) return assert_not_nil
I'm trying to write a basic client/server echo program, to test the usage of
Excuse the poor title... I'm trying to write a basic form for a login
I'm trying to write a php function that gets all the basic food data.
I'm trying to write a topic with durable subscriber. I got my basic topic:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.