[fpc-pascal] Re: Re: TPLY

2010-10-29 Thread leledumbo

> I would start with this site to learn how to create recursive descent
> parsers using Pascal :) 

Definitely, but it doesn't build AST, which is required if you need to write
a parser for a language that can't be parsed in single pass like Java.

-- 
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/TPLY-tp3235828p3241740.html
Sent from the Free Pascal - General mailing list archive at Nabble.com.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] TPLY

2010-10-29 Thread Thierry Coq

Brian,
thanks for the diff, I'll take it into account and publish an update.

On 28/10/2010 18:50, Brian Winfrey wrote:
...

The changes I made in this diff were simply to get it to compile.

Subsequently I renamed all files and folders to lowercase, converted
spaces to underscores and added a prefix to eliminate duplicate file
names where needed.

   

...

Another approach would be to look at (and reverse engineer) the byte code.
If it's not obfuscated, it might even be easier to parse and port than the
native Java.

 

How would you suggest I proceed in that.
   

Using the class file format (for example here: 
http://en.wikipedia.org/wiki/Class_%28file_format%29),
it would be easy to parse through the tables, identify the class name, 
its super class name, the interfaces it's implementing, and even the 
public and private methods. The java compiler has done all the work into 
translating the java code into nice tables. ;-)
I remember I did the exercise once. I've destroyed the code, but I could 
do it again. I remember one of the more difficult parts was 
understanding how java coded strings ;-) This was before anonymous 
classes and methods, so this could be another difficulty. I don't know 
how these are converted to byte code.
Once you have the structure, you can generate the pascal code. I would 
recommend against generating one class per unit as Java does: since 
pascal dependency rules are strict (no cycles), this would most 
certainly result in uncompilable code. What I do when I translate Java 
is to pre-declare all classes and interfaces at the top of the unit(s) 
and then generate the full class interface further down.
Translating the statements inside the bytecode I haven't tried, since my 
efforts were mostly for analyzing java code and measuring it.

I hope this helps,
Thierry

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Re: Re: TPLY

2010-10-29 Thread Adriaan van Os

Paul Nicholls wrote:
I would start with this site to learn how to create recursive descent 
parsers using Pascal :)


http://compilers.iecc.com/crenshaw/


I recommend 

Regards,

Adriaan van Os
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Re: Re: TPLY

2010-10-29 Thread Thierry Coq

I second that.
...


I recommend 

...
also Wirth's book on Project Oberon, where the compiler design is 
explained, and its purpose in the whole project:


http://www.oberon.ethz.ch/WirthPubl/ProjectOberon.pdf

in the physical world: ISBN 0-201-54428-8
I was able to buy a copy!

Thierry
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Re: Re: TPLY

2010-10-29 Thread Thierry Coq

Oops


http://www.oberon.ethz.ch/WirthPubl/ProjectOberon.pdf

here:
http://www-old.oberon.ethz.ch/WirthPubl/ProjectOberon.pdf

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Re: Changes in fcl-web

2010-10-29 Thread Joost van der Sluis
On Thu, 2010-10-28 at 06:59 -0700, leledumbo wrote:
> > They are up-to-date available in the fppkg repository. See the fppkg 
> > wiki page on how to set it up. Then: 
> > 
> > fppkg install webdesign 
> > 
> > will do the trick. And if not: tell me. Maybe you're the first one who 
> > uses it. 
> 
> Seems like fppkg doesn't support proxy yet, so I can't download it (I use
> campus internet which is behind a proxy). Could you please attach it?

Good catch. I'll add proxy support. 

Files can be downloaded here:
http://www.freepascal.org/repository/embweb-0.9.0-1.zip
http://www.freepascal.org/repository/webdesign-0.9.0-1.zip
http://www.freepascal.org/repository/lnet-0.6.4-2446.zip

Joost

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Re: Re: TPLY

2010-10-29 Thread David Riley
On Fri, 2010-10-29 at 09:24 +1100, Paul Nicholls wrote:
> "Brian Winfrey"  wrote in 
> message news:aanlktinq5bgnulg05nyuizl8bpoxdenu3ofyuqhnp...@mail.gmail.com...
> Thank you, What techiniques have you used in the past that you could
> share to get me started?
> 
> On Wed, Oct 27, 2010 at 8:04 PM, leledumbo 
>  wrote:
> >
> > Learn compilation technique, a recursive descent parser should be easy to
> > understand and code instead of learning automatic lexer and parser
> > generator. Plus, structurally, Java is a very simple language, so AST
> > transformation should be easy. With FPC 2.5.1, almost all Java constructs
> > can be directly translated to FPC dialect, minus anonymous inner class 
> > only
> > AFAIK.
> 
> I would start with this site to learn how to create recursive descent 
> parsers using Pascal :)
> 
> http://compilers.iecc.com/crenshaw/
> 
> Using this information as a starting point, I have created pascal-like 
> script languages (compiled to byte code), and pascal-like HL language 
> compiled to virtual machine ML instructions :)
> 
> cheers,
> Paul 
> 
> 
> 
> ___
> fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal

A book I'd recommend reading in addition to the Dr. Jack Crenshaw
articles mentioned above would be "Compiler Construction" by Niklaus
Wirth.  It's goes in to a lot more detail than "Let's Build A Compiler"
but still start with the basics.  I found it here:
www-old.oberon.ethz.ch/WirthPubl/CBEAll.pdf .  Mr. (Dr. yet?) Florian
Klaempfl should write a book, he seems to have done pretty good with the
whole Pascal compiler thing.  With the entire FPC crew you'd each only
have to write a few chapters...  

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] Re: Changes in fcl-web

2010-10-29 Thread leledumbo

Thanks, I'll try as soon as I arrive at home. Anyway, the Gecko and jQuery
package can still be used from the last WebDesign package or have the
dependencies been dropped?
-- 
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/Changes-in-fcl-web-tp3239906p3242077.html
Sent from the Free Pascal - General mailing list archive at Nabble.com.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] setting variables with DWARF in gdb

2010-10-29 Thread Seth Grover
When I compile an FPC program for debug with DWARF symbols, GDB
seemingly ignores my commands to set variables or registers when
debugging:

With STABS (or whatever the default is, ie., -gw is not set):

Breakpoint 1, DOIT () at /home/tlacuache/tmp/project1.lpr:14
14  writeln(MYVAR);
(gdb) print MYVAR
$1 = 1
(gdb) set MYVAR=32
(gdb) print MYVAR
$2 = 32

With DWARF:

Breakpoint 1, DOIT () at project1.lpr:14
14  writeln(MYVAR);
(gdb) print MYVAR
$1 = 1
(gdb) SET MYVAR=32
(gdb) print MYVAR
$2 = 1

Am I doing something wrong? Should I log a bug in mantis?

-SG

--
This email is fiction. Any resemblance to actual events
or persons living or dead is purely coincidental.

Seth Grover
sethdgrover[at]gmail[dot]com
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] Re: setting variables with DWARF in gdb

2010-10-29 Thread Seth Grover
I *was* doing something wrong... doing a ":=" (pascal-style
assignment) rather than just "=" seems to work Ok.

-SG

--
This email is fiction. Any resemblance to actual events
or persons living or dead is purely coincidental.

Seth Grover
sethdgrover[at]gmail[dot]com



On Fri, Oct 29, 2010 at 10:58 AM, Seth Grover  wrote:
> When I compile an FPC program for debug with DWARF symbols, GDB
> seemingly ignores my commands to set variables or registers when
> debugging:
>
> With STABS (or whatever the default is, ie., -gw is not set):
>
> Breakpoint 1, DOIT () at /home/tlacuache/tmp/project1.lpr:14
> 14          writeln(MYVAR);
> (gdb) print MYVAR
> $1 = 1
> (gdb) set MYVAR=32
> (gdb) print MYVAR
> $2 = 32
>
> With DWARF:
>
> Breakpoint 1, DOIT () at project1.lpr:14
> 14          writeln(MYVAR);
> (gdb) print MYVAR
> $1 = 1
> (gdb) SET MYVAR=32
> (gdb) print MYVAR
> $2 = 1
>
> Am I doing something wrong? Should I log a bug in mantis?
>
> -SG
>
> --
> This email is fiction. Any resemblance to actual events
> or persons living or dead is purely coincidental.
>
> Seth Grover
> sethdgrover[at]gmail[dot]com
>
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Re: Re: TPLY

2010-10-29 Thread Brian Winfrey
Well, seems like you all have given some material to get me started.
As nobody suggested sticking with TPLY or plex/bison I will
back-burner that and proceed with crenshaw/oberon.

Thanks to everyone.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] TPLY

2010-10-29 Thread Brian Winfrey
Thanks, I'll look into this as well.

On Fri, Oct 29, 2010 at 2:19 AM, Thierry Coq  wrote:
> Brian,
> thanks for the diff, I'll take it into account and publish an update.
>
> On 28/10/2010 18:50, Brian Winfrey wrote:
> ...
>>
>> The changes I made in this diff were simply to get it to compile.
>>
>> Subsequently I renamed all files and folders to lowercase, converted
>> spaces to underscores and added a prefix to eliminate duplicate file
>> names where needed.
>>
>>
>
> ...
>>>
>>> Another approach would be to look at (and reverse engineer) the byte
>>> code.
>>> If it's not obfuscated, it might even be easier to parse and port than
>>> the
>>> native Java.
>>>
>>>
>>
>> How would you suggest I proceed in that.
>>
>
> Using the class file format (for example here:
> http://en.wikipedia.org/wiki/Class_%28file_format%29),
> it would be easy to parse through the tables, identify the class name, its
> super class name, the interfaces it's implementing, and even the public and
> private methods. The java compiler has done all the work into translating
> the java code into nice tables. ;-)
> I remember I did the exercise once. I've destroyed the code, but I could do
> it again. I remember one of the more difficult parts was understanding how
> java coded strings ;-) This was before anonymous classes and methods, so
> this could be another difficulty. I don't know how these are converted to
> byte code.
> Once you have the structure, you can generate the pascal code. I would
> recommend against generating one class per unit as Java does: since pascal
> dependency rules are strict (no cycles), this would most certainly result in
> uncompilable code. What I do when I translate Java is to pre-declare all
> classes and interfaces at the top of the unit(s) and then generate the full
> class interface further down.
> Translating the statements inside the bytecode I haven't tried, since my
> efforts were mostly for analyzing java code and measuring it.
> I hope this helps,
> Thierry
>
> ___
> fpc-pascal maillist  -  fpc-pas...@lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Re: Changes in fcl-web

2010-10-29 Thread Joost van der Sluis
On Fri, 2010-10-29 at 07:19 -0700, leledumbo wrote:
> Thanks, I'll try as soon as I arrive at home. Anyway, the Gecko and jQuery
> package can still be used from the last WebDesign package or have the
> dependencies been dropped?

Geckoport was commented-out, because it only worked on Windows. Now it
works on other platforms too, I'll add a fpmake package for it.

The jQuery package also doesn't have a fpmake package yet. I'll add that
too.

Joost.

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] Re: Changes in fcl-web

2010-10-29 Thread leledumbo

> Geckoport was commented-out, because it only worked on Windows. Now it 
> works on other platforms too, I'll add a fpmake package for it.

So, in the download package you attach, what would the html previewer be
instead of Gecko?
-- 
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/Changes-in-fcl-web-tp3239906p3243080.html
Sent from the Free Pascal - General mailing list archive at Nabble.com.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal