Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [jdt-core-dev] Compiler patch

Szia David!

In order to add new keywords, you should modify the Java scanner, to add
your custom new keyword in there.
Then, you need to modify the grammar, and regenerate the parser. If you
check the ISV documentation for JDT/Core, you'll find a note on how to do
so.
I presume this new keyword would end-up being a new modifier, in which case
the existing support could be funaced (there are still a few bits left),
look at Parser#consumeModifiers.
Once you get there, you would hack the class LocalDeclaration to have it
dump the right sequence of bytecodes.

Good luck,
Philippe



|---------+------------------------------>
|         |           Erdős Dávid        |
|         |           <david.erdos@infor.|
|         |           hu>                |
|         |           Sent by:           |
|         |           jdt-core-dev-admin@|
|         |           eclipse.org        |
|         |                              |
|         |                              |
|         |           10/14/2002 02:53 PM|
|         |           Please respond to  |
|         |           jdt-core-dev       |
|         |                              |
|---------+------------------------------>
  >---------------------------------------------------------------------------------------------------------------|
  |                                                                                                               |
  |       To:       "'jdt-core-dev@xxxxxxxxxxx'" <jdt-core-dev@xxxxxxxxxxx>                                       |
  |       cc:                                                                                                     |
  |       Subject:  RE: [jdt-core-dev] Compiler patch                                                             |
  >---------------------------------------------------------------------------------------------------------------|




OK!

I understand what you mean.
But it would be just a sample. We just would like to know how many
expenditure ist it to change the compiler, in case we'd modify or extend
the
langauge. So, however the precompiler approach is suitable for this case,
we'd like to change the compiler and see what it takes....

bye
David Erdos

-----Original Message-----
From: Scott Stanchfield [mailto:scott@xxxxxxxxxxxx]
Sent: Monday, October 14, 2002 2:42 PM
To: jdt-core-dev@xxxxxxxxxxx
Subject: RE: [jdt-core-dev] Compiler patch


Be careful of Java licensing issues. It can't be called "Java" unless it
implements exactly the language as defined in the JLS. The mods that the
Eclipse compiler folks have implemented are ok (extra optional warnings,
etc), but adding new keywords or changing the structure/meaning of the
language isn't.

Also, in general, adding new keywords is dangerous, as old code may already
be using the word as an identifier. Not just source, but library code that
you don't have source to, which may make it impossible to call methods that
happen to have the same name as your keyword.

If you really need to do this, I'd recommend taking a precompiler approach,
where you would just create the equivalent Java language statements by
processing your modifier.

-- Scott

==============================================================
Scott Stanchfield    scott@xxxxxxxxxxxx    http://javadude.com

Lead author of "Effective VisualAge for Java, Version 3"
                                      http://javadude.com/evaj

VisualAge for Java Tips and Tricks     http://javadude.com/vaj
Visit for Java Enlightenment!             http://www.jguru.com
==============================================================

> -----Original Message-----
> From: jdt-core-dev-admin@xxxxxxxxxxx
> [mailto:jdt-core-dev-admin@xxxxxxxxxxx]On Behalf Of Erdős Dávid
> Sent: Monday, October 14, 2002 8:23 AM
> To: 'jdt-core-dev@xxxxxxxxxxx'
> Subject: [jdt-core-dev] Compiler patch
>
>
> Hello!
>
> I'd like to patch the Eclipse compiler...
> I'd like to introduce a new local variable modifiert into the language
(it
> also should be a keyword)...
> So besides "final" the new modifier has to be useable on local variables.
> This modifier sholud infulence the compiler. It should insert
> some byte code
> into the generated class file...
>
> But I don't know how to begin with it. Is there a simple way to do this
> change?
>
>
> bye
> David Erdos
> _______________________________________________
> jdt-core-dev mailing list
> jdt-core-dev@xxxxxxxxxxx
> http://dev.eclipse.org/mailman/listinfo/jdt-core-dev
>


_______________________________________________
jdt-core-dev mailing list
jdt-core-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/jdt-core-dev
_______________________________________________
jdt-core-dev mailing list
jdt-core-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/jdt-core-dev






Back to the top