Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.compilers > #431 > unrolled thread

push lexer?

Started byDetlef Bosau <detlef.bosau@web.de>
First post2012-01-17 10:28 +0100
Last post2012-01-30 23:28 +0000
Articles 4 — 4 participants

Back to article view | Back to comp.compilers


Contents

  push lexer? Detlef Bosau <detlef.bosau@web.de> - 2012-01-17 10:28 +0100
    Re: Statistics on compiling the Free Pascal compiler for Win32 Sven Barth <pascaldragon@googlemail.com> - 2012-01-17 10:00 +0100
    Re: push lexer? Hans Aberg <haberg-news@telia.com> - 2012-01-17 21:06 +0100
      Re: push lexer? Johann 'Myrkraverk' Oskarsson <johann@2ndquadrant.com> - 2012-01-30 23:28 +0000

#431 — push lexer?

FromDetlef Bosau <detlef.bosau@web.de>
Date2012-01-17 10:28 +0100
Subjectpush lexer?
Message-ID<12-01-032@comp.compilers>
Bison 2.5 has a "push api".
http://www.gnu.org/software/bison/manual/html_node/Push-Parser-Function.html

Does there exist something similar for lex of flex or does somebody know
a "push scanner"?

Thanks.

Detlef
[Not that I've ever seen.  It would be straightforward to modify flex
to create push lexers that work with push parsers, but so far nobody's
done it. -John]

[toc] | [next] | [standalone]


#434 — Re: Statistics on compiling the Free Pascal compiler for Win32

FromSven Barth <pascaldragon@googlemail.com>
Date2012-01-17 10:00 +0100
SubjectRe: Statistics on compiling the Free Pascal compiler for Win32
Message-ID<12-01-035@comp.compilers>
In reply to#431
Am 17.01.2012 05:19, schrieb Paul Robinson:
> Compiling using the DOS IDE, I brought up the file PP.PAS, declared it
> as the primary file, for compiler switches, I entered into the IDE the
> following:
>
> Win32 I386 cpu32bitaddr
>
> Each time it did not find a Pascal Unit I cheated, looked for the file
> and copied it into the 'compiler' dir
ectory rather than try to set the
> directories in the IDE because I was having trouble or doing something
> wrong and it didn't find the files. So then, once it stopped
> complaining, I had it do a 'build' to do a complete scratch build of the
> compiler.

The following command is sufficient to build a compiler for the i386
platform (from inside cmd.exe):

fpc -FUlib -otestpp.exe -FE. -Fusystems -Fui386 -Fux86 -Fii386 -di386 pp.pas

"-FUlib" specifies that all *.o and *.ppu files are generated in
directory "lib" (which you need to create first)
"-otestpp.exe" specifies that the resulting executable should be named
"testpp.exe"
"-FE." tells the compiler that the resulting executable should be
created in teh current directory
"-FuXXX" are the directories which contain other used units
"-FiXXX" specifies directories which contain include files
"-di368" will generate a compiler for "i386". Other possibilities can be
seen in the comments of pp.pas

If you have already compiled the compiler using the Makefile ("make all"
in the top level directory of the FPC source or "make cycle" in the
directory of the compiler) then you can use the "manually" created
compiler to compile itself again using the following command:

testpp.exe -n -Fu{YOURSOURCEDIRECTORY}\rtl\units\i386-win32 -B -FUlib
"-otestpp2.exe" "-FE." -Fusystems -Fui386 -Fux86 -Fii386 -di386 -vinw pp.pas

"-n" tells the compiler not to use its default configuration file
The parameter containing {YOURSOURCEDIRECTORY} is the directory where
the Makefile (see above) compiled the RTL (RunTime Library) to (we need
that now that we don't use the default configuration).
"-B" tells the compiler to recompile all units.
We also use a different name, as "testpp.exe" can not be overriden while
it's running.
"-vinw" tells the compiler to display general information (like
"Compiling blabla.pas"), notes and warnings (this is normally also
included in the default configuration).

Regards,
Sven

[toc] | [prev] | [next] | [standalone]


#435

FromHans Aberg <haberg-news@telia.com>
Date2012-01-17 21:06 +0100
Message-ID<12-01-036@comp.compilers>
In reply to#431
On 2012/01/17 10:28, John Levine wrote:
>> Bison 2.5 has a "push api".
>> http://www.gnu.org/software/bison/manual/html_node/Push-Parser-Function.html
>>
>> Does there exist something similar for lex of flex or does somebody know
>> a "push scanner"?

> [Not that I've ever seen.  It would be straightforward to modify flex
> to create push lexers that work with push parsers, but so far nobody's
> done it. -John]

FYI, Flex is currently not maintained or developed.

Hans
[That's true, but it's sitting at Sourceforge, ready for anyone who
wants to pick it up. http://sourceforge.net/projects/flex/ -John]

[toc] | [prev] | [next] | [standalone]


#441

FromJohann 'Myrkraverk' Oskarsson <johann@2ndquadrant.com>
Date2012-01-30 23:28 +0000
Message-ID<12-01-042@comp.compilers>
In reply to#435
Hans Aberg <haberg-news@telia.com> writes:

> On 2012/01/17 10:28, John Levine wrote:
>>> Bison 2.5 has a "push api".
>>> http://www.gnu.org/software/bison/manual/html_node/Push-Parser-Function.html
>>>
>>> Does there exist something similar for lex of flex or does
>>> somebody know a "push scanner"?
>
>> [Not that I've ever seen.  It would be straightforward to modify
>> flex to create push lexers that work with push parsers, but so far
>> nobody's done it. -John]
>
> FYI, Flex is currently not maintained or developed.

> [That's true, but it's sitting at Sourceforge, ready for anyone who
> wants to pick it up. http://sourceforge.net/projects/flex/ -John]

There is also Reflex, maintained by Thomas Dickey at

http://invisible-island.net/reflex/reflex.html

He is most likely known as the guy behind ncurses and xterm.

I use Reflex among other things because I do use the -P flag too -- it
is broken in SourceForge Flex.


--
   Johann Oskarsson                http://www.2ndquadrant.com/    |[]
   PostgreSQL Development, 24x7 Support, Training and Services  --+--
                                                                  |
   Blog: http://my.opera.com/myrkraverk/blog/

[toc] | [prev] | [standalone]


Back to top | Article view | comp.compilers


csiph-web