Compile problem

View: New views
5 Messages — Rating Filter:   Alert me  

Compile problem

by Lucas Satabin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi everybody,

I am encountering some problems wanting to compile the sources of SableCC4.
I followed the instruction on this page
http://sablecc.org/wiki/ContributingCode to get the sources from the
repository, configured my eclipse, and used the ant build file to
generate the classes from the the grammars.
After this I still have problems and can not compile the Java sources.
It seems that the Java code need some nodes that does not exist anymore
in the grammar. I get some error messages such as :

 
/home/lucas/programmes/java/sablecc/src/org/sablecc/sablecc/structures/GlobalData.java:26:
  cannot find symbol
[javac] symbol  : class ALanguageName
[javac] location: package org.sablecc.sablecc.syntax3.node
[javac] import org.sablecc.sablecc.syntax3.node.ALanguageName;

or

The import org.sablecc.sablecc.syntax3.node.ASelection cannot be resolved

I am wondering if the classes correspond to the grammars on the repository.
Does anybody know how to compile the source from the repository?

Thanks in advance

Lucas

_______________________________________________
SableCC-Discussion mailing list
SableCC-Discussion@...
http://lists.sablecc.org/listinfo/sablecc-discussion

Re: Compile problem

by Etienne M. Gagnon :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Lucas,

It seems that you are the first person to try it. I have stopped making
my work in progress public a relatively long while ago. I left this
minor compilation problem in place so that I would get feedback when
somebody tried the code. I'll push the fix into the repository later today.

Can I ask you what do you intend to do with the code? You know that it
does not generate any output, right?

Etienne

Lucas Satabin wrote:

> Hi everybody,
>
> I am encountering some problems wanting to compile the sources of SableCC4.
> I followed the instruction on this page
> http://sablecc.org/wiki/ContributingCode to get the sources from the
> repository, ... I get some error messages such as :
>
>  
> /home/lucas/programmes/java/sablecc/src/org/sablecc/sablecc/structures/GlobalData.java:26:
>   cannot find symbol
> [javac] symbol  : class ALanguageName
> [javac] location: package org.sablecc.sablecc.syntax3.node
> [javac] import org.sablecc.sablecc.syntax3.node.ALanguageName;
>  
--
Etienne M. Gagnon, Ph.D.
SableCC:                                            http://sablecc.org




_______________________________________________
SableCC-Discussion mailing list
SableCC-Discussion@...
http://lists.sablecc.org/listinfo/sablecc-discussion

signature.asc (265 bytes) Download Attachment

Re: Compile problem

by Lucas Satabin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

Yes I know it does not produce anything for the moment ;)
I checked out the code because I am really interested in developing a
compiler compiler and the concepts used in SableCC are really
interesting. I would like to understand how does it work, and I also had
the idea to produce Scala code with SableCC. That's why I wanted to
understand how the new macro system is made.
And why not if I have some interesting ideas I could help :)

Lucas

Etienne M. Gagnon a écrit :

> Hi Lucas,
>
> It seems that you are the first person to try it. I have stopped making
> my work in progress public a relatively long while ago. I left this
> minor compilation problem in place so that I would get feedback when
> somebody tried the code. I'll push the fix into the repository later today.
>
> Can I ask you what do you intend to do with the code? You know that it
> does not generate any output, right?
>
> Etienne
>
> Lucas Satabin wrote:
>> Hi everybody,
>>
>> I am encountering some problems wanting to compile the sources of SableCC4.
>> I followed the instruction on this page
>> http://sablecc.org/wiki/ContributingCode to get the sources from the
>> repository, ... I get some error messages such as :
>>
>>  
>> /home/lucas/programmes/java/sablecc/src/org/sablecc/sablecc/structures/GlobalData.java:26:
>>   cannot find symbol
>> [javac] symbol  : class ALanguageName
>> [javac] location: package org.sablecc.sablecc.syntax3.node
>> [javac] import org.sablecc.sablecc.syntax3.node.ALanguageName;
>>  
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> SableCC-Discussion mailing list
> SableCC-Discussion@...
> http://lists.sablecc.org/listinfo/sablecc-discussion


_______________________________________________
SableCC-Discussion mailing list
SableCC-Discussion@...
http://lists.sablecc.org/listinfo/sablecc-discussion

Re: Compile problem

by Etienne M. Gagnon :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Lucas,

This is really great! I would love SableCC and ObjectMacro to have a Scala back-end. For this reason, it took me longer than anticipated to fix the repository. I wanted to make sure you got a version of ObjectMacro I would be comfortable for you to start playing with now. So, if you fetch the latest updates, you will get a "stable" version of ObjectMacro.

Note: There's no need, really, to develop a distinct compiler generator for Scala based on SableCC ideas. SableCC 4 is designed explicitly to support various back-ends. (Unless you wanted to develop something entirely different, of course, e.g. not a linear approximate LR(K) parser, not a "DFA with markers" lexer generator", etc.)

So, let's get you started on ObjectMacro.

The current ObjectMacro already supports two targets:
  1. java: generates a set of Java classes implementing the object model implied by the macro source file.
  2. intermediate: generates an intermediate representation of the object model, appropriate for reading/parsing then generating a set of classes in a new target language.
Internally, ObjectMacro generates an AST in pure "intermediate" form. Then, it exclusively uses this AST to generate code.

The idea is that, to write a back-end for a new target, all one needs to do is to:
  1. Generate an intermediate representation: java -jar ObjectMacro -t intermediate sourcefile.objectmacro
  2. Using the provided objectmacrointermediate.sablecc3 grammar, write a parser (using SableCC 3) that reads the intermediate result (sourcefile.objectmacro_intermediate) and creates an AST.
  3. Using some ObjectMacro templates (hey, it works, so why not use it!) and some java code (to glue pieces together), walk the AST and generate the classes in the new target language.
The resulting back-end can easily be integrated, later, within ObjectMacro almost as-is! All this requires is a very few lines of code to add the new target and call the back-end.

This architectural organization is very flexible. You could eventually write the Scala backend in Scala, without needing to rewrite SableCC nor Object macro in Scala (nor dynamically linking with Java). You simply use ObjectMacro to generate the intermediate output file. Then, you would use SableCC to generate a parser (selecting its scala target), and write the back-end in Scala. Of course, this would require some scala back-end to be written in Java, initially, for both SableCC and ObjectMacro.

So, please have a little look at ObjectMacro. You only need to look at:
  1. The grammars: objectmacro.sablecc3 and objectmacrointermediate.sablecc3
  2. The two existing back-ends:
    1. The org.sablecc.objectmacro.codegeneration package (and subpackages)
    2. The macro templates: macros/objectmacro-[intermediate|java].objectmacro
  3. Some examples of input/output, e.g. input = objectmacro-errormessages.objectmacro, output = org.sablecc.objectmacro.errormessages.* classes
Of course, you will very likely have some questions, as there is not some nice document explaining the system... Please ask them here. :-)

Hoping you have fun starting the work on a Scala back-end for ObjectMacro!

Etienne
PS: Please do not start playing with the SableCC code nor try to write a back-end. The public code is not up to date with my latest internal code, and it's not ready for prime time.

Lucas Satabin wrote:
Hi,

Yes I know it does not produce anything for the moment ;)
I checked out the code because I am really interested in developing a
compiler compiler and the concepts used in SableCC are really
interesting. I would like to understand how does it work, and I also had
the idea to produce Scala code with SableCC. That's why I wanted to
understand how the new macro system is made.
And why not if I have some interesting ideas I could help :)

Lucas

  

-- 
Etienne M. Gagnon, Ph.D.
SableCC:                                            http://sablecc.org


_______________________________________________
SableCC-Discussion mailing list
SableCC-Discussion@...
http://lists.sablecc.org/listinfo/sablecc-discussion

signature.asc (265 bytes) Download Attachment

Re: Compile problem

by Lucas Satabin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Etienne,

Thanks a lot for all these details and for going to a lot of trouble for me ;-)
I'll try this when I'm at home. The macro structure sounds really powerful and I think I will need some times to really take advantages of this, it will have a lot of fun...

Lucas

Etienne M. Gagnon schrieb:
Hi Lucas,

This is really great! I would love SableCC and ObjectMacro to have a Scala back-end. For this reason, it took me longer than anticipated to fix the repository. I wanted to make sure you got a version of ObjectMacro I would be comfortable for you to start playing with now. So, if you fetch the latest updates, you will get a "stable" version of ObjectMacro.

Note: There's no need, really, to develop a distinct compiler generator for Scala based on SableCC ideas. SableCC 4 is designed explicitly to support various back-ends. (Unless you wanted to develop something entirely different, of course, e.g. not a linear approximate LR(K) parser, not a "DFA with markers" lexer generator", etc.)

So, let's get you started on ObjectMacro.

The current ObjectMacro already supports two targets:
  1. java: generates a set of Java classes implementing the object model implied by the macro source file.
  2. intermediate: generates an intermediate representation of the object model, appropriate for reading/parsing then generating a set of classes in a new target language.
Internally, ObjectMacro generates an AST in pure "intermediate" form. Then, it exclusively uses this AST to generate code.

The idea is that, to write a back-end for a new target, all one needs to do is to:
  1. Generate an intermediate representation: java -jar ObjectMacro -t intermediate sourcefile.objectmacro
  2. Using the provided objectmacrointermediate.sablecc3 grammar, write a parser (using SableCC 3) that reads the intermediate result (sourcefile.objectmacro_intermediate) and creates an AST.
  3. Using some ObjectMacro templates (hey, it works, so why not use it!) and some java code (to glue pieces together), walk the AST and generate the classes in the new target language.
The resulting back-end can easily be integrated, later, within ObjectMacro almost as-is! All this requires is a very few lines of code to add the new target and call the back-end.

This architectural organization is very flexible. You could eventually write the Scala backend in Scala, without needing to rewrite SableCC nor Object macro in Scala (nor dynamically linking with Java). You simply use ObjectMacro to generate the intermediate output file. Then, you would use SableCC to generate a parser (selecting its scala target), and write the back-end in Scala. Of course, this would require some scala back-end to be written in Java, initially, for both SableCC and ObjectMacro.

So, please have a little look at ObjectMacro. You only need to look at:
  1. The grammars: objectmacro.sablecc3 and objectmacrointermediate.sablecc3
  2. The two existing back-ends:
    1. The org.sablecc.objectmacro.codegeneration package (and subpackages)
    2. The macro templates: macros/objectmacro-[intermediate|java].objectmacro
  3. Some examples of input/output, e.g. input = objectmacro-errormessages.objectmacro, output = org.sablecc.objectmacro.errormessages.* classes
Of course, you will very likely have some questions, as there is not some nice document explaining the system... Please ask them here. :-)

Hoping you have fun starting the work on a Scala back-end for ObjectMacro!

Etienne
PS: Please do not start playing with the SableCC code nor try to write a back-end. The public code is not up to date with my latest internal code, and it's not ready for prime time.

Lucas Satabin wrote:
Hi,

Yes I know it does not produce anything for the moment ;)
I checked out the code because I am really interested in developing a
compiler compiler and the concepts used in SableCC are really
interesting. I would like to understand how does it work, and I also had
the idea to produce Scala code with SableCC. That's why I wanted to
understand how the new macro system is made.
And why not if I have some interesting ideas I could help :)

Lucas

  

-- 
Etienne M. Gagnon, Ph.D.
SableCC:                                            http://sablecc.org
  

_______________________________________________ SableCC-Discussion mailing list SableCC-Discussion@... http://lists.sablecc.org/listinfo/sablecc-discussion


_______________________________________________
SableCC-Discussion mailing list
SableCC-Discussion@...
http://lists.sablecc.org/listinfo/sablecc-discussion