I'm trying to evaluate ICE for possible use in an upcoming project, comparing it with .NET Remoting and various CORBA ORBs. ICE docs are impressive, and the features seem right, particularly AMD support in multiple languages. Now that I'm getting down to trying out the tools and hopefully writing a demo client/server pair, I'm flummoxed by what seems like the most basic thing.
I downloaded Ice-3.0.0-VC71.msi (also previously tried 2.1.2 and 2.1.1), and executed it. I let it install to the default C:\Ice-3.0.0\ and used the Complete install option, rather than Custom. This is on WinXP SP2.
Now I want to create Java and C# proxy & skeleton code corresponding to a simple Slice interface. I tried my own .ice file, but got unhelpful "syntax error" messages. Now I'm just trying to compile one of the simple demo .ice files.
I assumed the compilers (slice2java, slice2cs) would work on the command-line out of the box, but since they don't seem to (at least for me), I've tried setting ICE_HOME, PATH and even JAVA_HOME variables as recommended somewhere, and also tried building the provided demo projects in Visual Studio 7.1 (for C#) and ant (for Java). The results are always the same: "syntax error" messages without other information (such as line numbers).
Seems like I've got something configured wrong, or some dependency is missing, but I'm out of ideas as to what.
Anyone know this one? Any advice?
Seems like the parser is unhappy with something at the beginning of the file. The debug output below shows it recognizing various tokens properly, but the initial syntax error (due to token $undefined?) seems to have thrown everything off. Also, longer, more complex demo .ice files may result in similar "syntax error" messages in the beginning, followed by more informative errors that specify the file and line number and identify particular issues. In other words, the parser seems to "recover", but does so mid-scope, so it doesn't recognize valid slice code, complaining (for example) that interfaces in a module are declared at global scope.
Here's a demo .ice file I've tried:
Code:
C:\> type C:\Ice-3.0.0\demoj\book\printer\Printer.ice
// **********************************************************************
//
// Copyright (c) 2003-2005 ZeroC, Inc. All rights reserved.
//
// This copy of Ice is licensed to you under the terms described in the
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
#ifndef SIMPLE_ICE
#define SIMPLE_ICE
module Demo
{
interface Printer
{
void printString(string s);
};
};
#endif
And here's me trying to compile it to java:
Code:
C:\> c:\Ice-3.0.0\bin\slice2java.exe C:\Ice-3.0.0\demoj\book\printer\Printer.ice
syntax error
syntax error
syntax error
Same result with java2cs.exe and java2cpp.exe.
Here's the same, with debug output enabled:
Code:
C:\> c:\Ice-3.0.0\bin\slice2java.exe -d C:\Ice-3.0.0\demoj\book\printer\Printer.ice
Starting parse
Entering state 0
Reading a token: Next token is token $undefined ()
syntax error
Shifting token error ()
Entering state 1
Next token is token $undefined ()
Error: discarding token $undefined ()
Error: popping token error ()
Stack now 0
Shifting token error ()
Entering state 1
Reading a token: Next token is token ICE_INTEGER_LITERAL ()
Error: discarding token ICE_INTEGER_LITERAL ()
Error: popping token error ()
Stack now 0
Shifting token error ()
Entering state 1
Reading a token: Next token is token ICE_STRING_LITERAL ()
Error: discarding token ICE_STRING_LITERAL ()
Error: popping token error ()
Stack now 0
Shifting token error ()
Entering state 1
Reading a token: Next token is token ICE_MODULE ()
Error: discarding token ICE_MODULE ()
Error: popping token error ()
Stack now 0
Shifting token error ()
Entering state 1
Reading a token: Next token is token ICE_IDENTIFIER ()
Error: discarding token ICE_IDENTIFIER ()
Error: popping token error ()
Stack now 0
Shifting token error ()
Entering state 1
Reading a token: Next token is token '{' ()
Error: discarding token '{' ()
Error: popping token error ()
Stack now 0
Shifting token error ()
Entering state 1
Reading a token: Next token is token ICE_INTERFACE ()
Error: discarding token ICE_INTERFACE ()
Error: popping token error ()
Stack now 0
Shifting token error ()
Entering state 1
Reading a token: Next token is token ICE_IDENTIFIER ()
Error: discarding token ICE_IDENTIFIER ()
Error: popping token error ()
Stack now 0
Shifting token error ()
Entering state 1
Reading a token: Next token is token '{' ()
Error: discarding token '{' ()
Error: popping token error ()
Stack now 0
Shifting token error ()
Entering state 1
Reading a token: Next token is token ICE_VOID ()
Error: discarding token ICE_VOID ()
Error: popping token error ()
Stack now 0
Shifting token error ()
Entering state 1
Reading a token: Next token is token ICE_IDENT_OP ()
Error: discarding token ICE_IDENT_OP ()
Error: popping token error ()
Stack now 0
Shifting token error ()
Entering state 1
Reading a token: Next token is token ICE_STRING ()
Error: discarding token ICE_STRING ()
Error: popping token error ()
Stack now 0
Shifting token error ()
Entering state 1
Reading a token: Next token is token ICE_IDENTIFIER ()
Error: discarding token ICE_IDENTIFIER ()
Error: popping token error ()
Stack now 0
Shifting token error ()
Entering state 1
Reading a token: Next token is token ')' ()
Error: discarding token ')' ()
Error: popping token error ()
Stack now 0
Shifting token error ()
Entering state 1
Reading a token: Next token is token ';' ()
Shifting token ';' ()
Entering state 8
Reducing stack by rule 9 (line 153), -> @3
Stack now 0 1 8
Entering state 33
Reading a token: Next token is token '}' ()
Reducing stack by rule 12 (line 162), -> definitions
Stack now 0 1 8 33
Entering state 67
Reducing stack by rule 10 (line 152), error ';' @3 definitions -> definitions
Stack now 0
Entering state 7
Reducing stack by rule 1 (line 102), definitions -> start
Stack now 0
Entering state 4
Next token is token '}' ()
syntax error
Error: popping nterm start ()
Stack now 0
Shifting token error ()
Entering state 1
Next token is token '}' ()
Error: discarding token '}' ()
Error: popping token error ()
Stack now 0
Shifting token error ()
Entering state 1
Reading a token: Next token is token ';' ()
Shifting token ';' ()
Entering state 8
Reducing stack by rule 9 (line 153), -> @3
Stack now 0 1 8
Entering state 33
Reading a token: Next token is token '}' ()
Reducing stack by rule 12 (line 162), -> definitions
Stack now 0 1 8 33
Entering state 67
Reducing stack by rule 10 (line 152), error ';' @3 definitions -> definitions
Stack now 0
Entering state 7
Reducing stack by rule 1 (line 102), definitions -> start
Stack now 0
Entering state 4
Next token is token '}' ()
syntax error
Error: popping nterm start ()
Stack now 0
Shifting token error ()
Entering state 1
Next token is token '}' ()
Error: discarding token '}' ()
Error: popping token error ()
Stack now 0
Shifting token error ()
Entering state 1
Reading a token: Next token is token ';' ()
Shifting token ';' ()
Entering state 8
Reducing stack by rule 9 (line 153), -> @3
Stack now 0 1 8
Entering state 33
Reading a token: Now at end of input.
Reducing stack by rule 12 (line 162), -> definitions
Stack now 0 1 8 33
Entering state 67
Reducing stack by rule 10 (line 152), error ';' @3 definitions -> definitions
Stack now 0
Entering state 7
Reducing stack by rule 1 (line 102), definitions -> start
Stack now 0
Entering state 4
Now at end of input.