Re: [fpc-pascal] Get user ID for name on Linux

2018-01-02 Thread Graeme Geldenhuys

On 2018-01-03 00:12, Tobias Giesen wrote:

Unfortunately Libc and UnixUtils don't seem to be available in 64-bit, so I 
can't call the
functions getpwnam or GetUserId.


As Marco said, you can use the "users" unit. Here is an example of how I 
use in in fpGUI, and it supports 32-bit and 64-bit systems.



https://github.com/graemeg/fpGUI/blob/develop/src/corelib/x11/fpg_x11.pas#L4010-L4044

Note though that it only works for Linux. So other UNIX-type systems 
like FreeBSD and Solaris are not supported.



Regards,
  Graeme

--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

My public PGP key:  http://tinyurl.com/graeme-pgp
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Get user ID for name on Linux

2018-01-02 Thread Marco van de Voort
In our previous episode, Tobias Giesen said:
> I would like to get the user ID for a Linux user name.
> 
> Unfortunately Libc and UnixUtils don't seem to be available in 64-bit, so I 
> can't call the
> functions getpwnam or GetUserId. Is there a replacement? Or could I define 
> and 
> import the function myself? 

Try the units in package users (packages/users in the sources)
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

[fpc-pascal] Get user ID for name on Linux

2018-01-02 Thread Tobias Giesen
Hello,

I would like to get the user ID for a Linux user name.

Unfortunately Libc and UnixUtils don't seem to be available in 64-bit, so I 
can't call the
functions getpwnam or GetUserId. Is there a replacement? Or could I define and 
import the function myself? 

Thanks for any help!

Cheers,
Tobias


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

Re: [fpc-pascal] Modern Compiler Construction using Pascal

2018-01-02 Thread Marc Santhoff
On Mon, 2018-01-01 at 13:17 -0500, Yves Cloutier wrote:
> Hi there,
> 
> I'd be interested to know if any modern compilers have been written
> in
> Pascal (other than the Pascal Compiler).

A bit outdated, but intresting:

http://pascaland.org/pascall.htm

-- 
Marc Santhoff 
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Modern Compiler Construction using Pascal

2018-01-02 Thread Santiago A.
El 01/01/2018 a las 19:17, Yves Cloutier escribió:
> Hi there,
>
> I'd be interested to know if any modern compilers have been written in
> Pascal (other than the Pascal Compiler).
>
> It's unfortunate that that most Pascal books out there are rather
> dated.  I did recently purchase 

The first version of nim language  https://nim-lang.org/ was written in
Pascal. Here are the sources
https://github.com/nim-lang/Nim/tree/ea1f1ec6d4d6c776eb0f81c2bebdd4cb4c817ebe/nim

Many times, when compiler is mature, the compiler is re-written in the
target language itself. Freepascal compiler is written in Freepascal.

First version of compiler must be written in other language, (of course,
the are not compilers for the language ), usually a language that
generates binary, compiling is very demanding to rely on virtual
machines Probably that is why there are not Java compilers written in
Java, or Python or Perl compilers written in Python or Perl . As usual,
the most popular language will be most used language: C, C++


-- 
Saludos

Santiago A.

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

Re: [fpc-pascal] Modern Compiler Construction using Pascal

2018-01-02 Thread Marc Santhoff
On Mon, 2018-01-01 at 13:17 -0500, Yves Cloutier wrote:
> Hi there,
> 
> I'd be interested to know if any modern compilers have been written in
> Pascal (other than the Pascal Compiler).
> 
> It's unfortunate that that most Pascal books out there are rather dated.  I
> did recently purchase
> mailman/listinfo/fpc-pascal

Pascal purists, please do not read on!



Really good an modern books on writing compilers are those from Terence
Parr. They are really readable and understandable, forget about the
Dragon Book.

The tool in use is the well known ANTLR, the newer versions implemented
in Java. If you want to build real compilers look for version 3, if
making DSLs is your target version 4 would be appropriate.

Have a look at antlr.org, the books to read are:

  "The Definitive ANTLR Reference - Building Domain Specific Languages"

Like the title says, a verbose and well written refernce for using
antlr.

The best book on the topic by far is (for me):

  "Language Implementation Patterns"

That's a very clear, pragmatic, and analytic view on compiler
construction. It is structured modular and easy to read. Guido van
Rossum, the creator of Python, writes about it "Throw away your
compiler theory book!"
I would really appreciate a translation of the code from the book to
pascal. ;)



Sorry for mentioning something nasty like Java on this list.

-- 
Marc Santhoff 
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Modern Compiler Construction using Pascal

2018-01-02 Thread greim



I guess you already noticed the book of the master himself: Nicklaus Wirth


https://www.inf.ethz.ch/personal/wirth/CompilerConstruction/index.html

Its revised 2017 (!) based on Oberon.

Afaik one of the first editions was based on Pascal.

Markus




Am 01.01.2018 um 19:17 schrieb Yves Cloutier:

Hi there,

I'd be interested to know if any modern compilers have been written in 
Pascal (other than the Pascal Compiler).


It's unfortunate that that most Pascal books out there are rather 
dated.  I did recently purchase



  Compiler Engineering Using Pascal (by Capon)


https://www.amazon.ca/Compiler-Engineering-Using-Pascal-Capon/dp/0333471555/ref=sr_1_1?ie=UTF8=1514829567=8-1=Compiler+Engineering+Using+PASCAL

And look forward to getting it in my mailbox.

I also have Brinch Hansen on Pascal Compilers. I did have another book 
on writing a compiler using pascal but it was using some framework which 
I was not able to find.


Another great book I have is Introduction to Compiler Construction by 
Thomas Parsons, but I was not able to follow it all the way through.


My interest for the moment is more for creating a DSL that scans, parses 
then generates Groff as its target code.


After gaining some experience with the process I would like to venture 
into writing a transpiler for something like SETL -> Pascal or Oberon -> 
Pascal.  There are other interesting older languages too like BCPL that 
could be used as the source language.  Implementing Icon in Pascal would 
be interesting as well as its implementation is extremely well 
documented in the book "Implementing Icon and Unicon" by Clinton Jeffery


I find the Pascal compiler to be really fast and the fact that it is 
available for so many platforms is very appealing.







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



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

Re: [fpc-pascal] Modern Compiler Construction using Pascal

2018-01-02 Thread Mattias Gaertner
On Mon, 1 Jan 2018 13:17:47 -0500
Yves Cloutier  wrote:

> Hi there,
> 
> I'd be interested to know if any modern compilers have been written in
> Pascal (other than the Pascal Compiler).

pas2js is written in FPC.

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

[fpc-pascal] Modern Compiler Construction using Pascal

2018-01-02 Thread Yves Cloutier
Hi there,

I'd be interested to know if any modern compilers have been written in
Pascal (other than the Pascal Compiler).

It's unfortunate that that most Pascal books out there are rather dated.  I
did recently purchase

Compiler Engineering Using Pascal (by Capon)

https://www.amazon.ca/Compiler-Engineering-Using-Pascal-Capon/dp/0333471555/ref=sr_1_1?ie=UTF8=1514829567=8-1=Compiler+Engineering+Using+PASCAL

And look forward to getting it in my mailbox.

I also have Brinch Hansen on Pascal Compilers. I did have another book on
writing a compiler using pascal but it was using some framework which I was
not able to find.

Another great book I have is Introduction to Compiler Construction by
Thomas Parsons, but I was not able to follow it all the way through.

My interest for the moment is more for creating a DSL that scans, parses
then generates Groff as its target code.

After gaining some experience with the process I would like to venture into
writing a transpiler for something like SETL -> Pascal or Oberon ->
Pascal.  There are other interesting older languages too like BCPL that
could be used as the source language.  Implementing Icon in Pascal would be
interesting as well as its implementation is extremely well documented in
the book "Implementing Icon and Unicon" by Clinton Jeffery

I find the Pascal compiler to be really fast and the fact that it is
available for so many platforms is very appealing.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal