at t yacc
Sponsored Links
Sponsored Links
Secleted [ 0 ] software to compare
Results 1 - 15 of about 51
Berkeley Yacc
Berkeley Yacc is a high-quality yacc variant. more>>
Berkeley Yacc (byacc) is generally conceded to be the best yacc variant available. In contrast to bison, it is written to avoid dependencies upon a particular compiler.
Byacc was written around 1990 by Robert Corbett who is the original author of bison. Originally written in K&R C, I have modified it to conform to ANSI C, and made other improvements.
Enhancements:
- configure.in: add AC_ARG_PROGRAM to make --program-prefix, etc., work.
- makefile.in: first cut of script to support --program-prefix
- configure.in: reorder AC_INIT/AC_CONFIG_HEADER to make this "work" with autoconf 2.52
- makefile.in: modify so DESTDIR works
- makefile.in: use EXEEXT and OBJEXT
- configure.in: use CF_PROG_EXT generate a config.h
- defs.h: make this use the generated config.h
- skeleton.c: add a forward-reference for yyparse()
- aclocal.m4: add CF_CHECK_CACHE, needed for CF_PROG_EXT
- yacc.1: remove the discussion of TMPDIR since it is obsolete
- skeleton.c: fix a couple of minor compiler-warnings in the skeleton
- defs.h: remove action_file_name, etc., since we use tmpfile() now.
- main.c: use tmpfile() for opening the working files. This quiets an idiot-warning advertising the use of mkstemp().
- output.c: Do not close temporary-files here, since they are opened with tmpfile(). Just rewind them, and theyre ready to read back the data stored in them.
- test/grammar.output, test/grammar.tab.c, test/grammar.tab.h: RCS_BASE
- makefile.in: turn on "make check" rule
- test/calc.output, test/run_test.sh, test/calc.tab.h: RCS_BASE
- test/ftp.tab.c: yyparse() is now yyparse(void)
- test/calc.tab.c: RCS_BASE
- test/error.tab.c: yyparse() is now yyparse(void)
- test/README: RCS_BASE
- yacc.1: various typography fixes prompted by Debian #100947
- aclocal.m4, makefile.in, configure.in: RCS_BASE
- README: updated to note that this is not the original
<<lessByacc was written around 1990 by Robert Corbett who is the original author of bison. Originally written in K&R C, I have modified it to conform to ANSI C, and made other improvements.
Enhancements:
- configure.in: add AC_ARG_PROGRAM to make --program-prefix, etc., work.
- makefile.in: first cut of script to support --program-prefix
- configure.in: reorder AC_INIT/AC_CONFIG_HEADER to make this "work" with autoconf 2.52
- makefile.in: modify so DESTDIR works
- makefile.in: use EXEEXT and OBJEXT
- configure.in: use CF_PROG_EXT generate a config.h
- defs.h: make this use the generated config.h
- skeleton.c: add a forward-reference for yyparse()
- aclocal.m4: add CF_CHECK_CACHE, needed for CF_PROG_EXT
- yacc.1: remove the discussion of TMPDIR since it is obsolete
- skeleton.c: fix a couple of minor compiler-warnings in the skeleton
- defs.h: remove action_file_name, etc., since we use tmpfile() now.
- main.c: use tmpfile() for opening the working files. This quiets an idiot-warning advertising the use of mkstemp().
- output.c: Do not close temporary-files here, since they are opened with tmpfile(). Just rewind them, and theyre ready to read back the data stored in them.
- test/grammar.output, test/grammar.tab.c, test/grammar.tab.h: RCS_BASE
- makefile.in: turn on "make check" rule
- test/calc.output, test/run_test.sh, test/calc.tab.h: RCS_BASE
- test/ftp.tab.c: yyparse() is now yyparse(void)
- test/calc.tab.c: RCS_BASE
- test/error.tab.c: yyparse() is now yyparse(void)
- test/README: RCS_BASE
- yacc.1: various typography fixes prompted by Debian #100947
- aclocal.m4, makefile.in, configure.in: RCS_BASE
- README: updated to note that this is not the original
Download (0.12MB)
Added: 2005-04-13 License: Freely Distributable Price:
1679 downloads
byacc 1.9.1
Berkeley Yacc is an LALR(1) parser generator. more>>
Berkeley Yacc is an LALR(1) parser generator. Berkeley Yacc has been made as compatible as possible with AT&T Yacc. Berkeley Yacc can accept any input specification that conforms to the AT&T Yacc documentation. Specifications that take advantage of undocumented features of AT&T Yacc will probably be rejected.
Berkeley Yacc is distributed with no warranty whatever. The code is certain to contain errors. Neither the author nor any contributor takes responsibility for any consequences of its use.
Berkeley Yacc is in the public domain. The data structures and algorithms used in Berkeley Yacc are all either taken from documents available to the general public or are inventions of the author. Anyone may freely distribute
source or binary forms of Berkeley Yacc whether unchanged or modified. Distributers may charge whatever fees they can obtain for Berkeley Yacc. Programs generated by Berkeley Yacc may be distributed freely.
<<lessBerkeley Yacc is distributed with no warranty whatever. The code is certain to contain errors. Neither the author nor any contributor takes responsibility for any consequences of its use.
Berkeley Yacc is in the public domain. The data structures and algorithms used in Berkeley Yacc are all either taken from documents available to the general public or are inventions of the author. Anyone may freely distribute
source or binary forms of Berkeley Yacc whether unchanged or modified. Distributers may charge whatever fees they can obtain for Berkeley Yacc. Programs generated by Berkeley Yacc may be distributed freely.
Download (0.063MB)
Added: 2007-02-15 License: GPL (GNU General Public License) Price:
986 downloads
omega t+ 1.4.6
omega t+ is a computer assisted translation (CAT) tool suite. more>>
omega t+ is a computer assisted translation (CAT) tool suite.
omega t+ currently includes omegat, a translation editor tool with numerous features, extspell, an Apsell spell checker user interface, sentseg, for sentence segmenting of documents, and OmegaT packages, from which omegat is derived.
<<lessomega t+ currently includes omegat, a translation editor tool with numerous features, extspell, an Apsell spell checker user interface, sentseg, for sentence segmenting of documents, and OmegaT packages, from which omegat is derived.
Download (0.64MB)
Added: 2006-05-30 License: GPL (GNU General Public License) Price:
1243 downloads
T-ish Pack 3.2
T-ish Pack provides a fast Clearlooks and Ubuntulooks themes for Gnome made to loosely resemble OSX Tiger. more>>
T-ish Pack provides a fast Clearlooks and Ubuntulooks themes for Gnome made to loosely resemble OSX Tiger.
They fit well with Compiz also.
Contents:
T-ish - Clearlooks theme
T-ish Aguastyle - Clearlooks theme with some pixmap elements
T-ish-Ubuntulooks - Ubuntlooks theme
T-ish-Ubuntulooks Aguastyle - Ubuntulooks theme with some pixmap elements
T-ish-Ubuntulooks Graphite - same as above but thanks to Alejandro Cornejo
Based on Clearlooks or Ubuntulooks engines, Ish GTK theme with additional buttons from Expose and GlossyP metacity borders (with many thanks to authors).
For best results use OSX icons, jaguarx mouse theme, and FoxiTiger firefox skin (links below).
IMPORTANT: In order to install all of the themes youll have to manually extract to ~/.themes dir.
IMPORTANT 2: In order for scrollbars to work on Ubuntu Edgy you have to install gtk2-engines-pixbuf package.
<<lessThey fit well with Compiz also.
Contents:
T-ish - Clearlooks theme
T-ish Aguastyle - Clearlooks theme with some pixmap elements
T-ish-Ubuntulooks - Ubuntlooks theme
T-ish-Ubuntulooks Aguastyle - Ubuntulooks theme with some pixmap elements
T-ish-Ubuntulooks Graphite - same as above but thanks to Alejandro Cornejo
Based on Clearlooks or Ubuntulooks engines, Ish GTK theme with additional buttons from Expose and GlossyP metacity borders (with many thanks to authors).
For best results use OSX icons, jaguarx mouse theme, and FoxiTiger firefox skin (links below).
IMPORTANT: In order to install all of the themes youll have to manually extract to ~/.themes dir.
IMPORTANT 2: In order for scrollbars to work on Ubuntu Edgy you have to install gtk2-engines-pixbuf package.
Download (0.65MB)
Added: 2007-03-01 License: GPL (GNU General Public License) Price:
584 downloads
Delphi Yacc & Lex 1.4
Delphi Yacc & Lex is a parser generator toolset for Delphi and Kylix, based on Turbo Pascal Lex and Yacc version 4.1. more>>
Delphi Yacc & Lex is a parser generator toolset for Delphi and Kylix, based on Turbo Pascal Lex and Yacc version 4.1.
The primary goal of Delphi Yacc & Lex is to clean up the code, and improve compatibility and maintainability.
The project started because the original Turbo Pascal Lex and Yacc did not compile well in Delphi 5+ or Kylix, the sourcecode was messy, and the last release or activity dates back to early 2000.
<<lessThe primary goal of Delphi Yacc & Lex is to clean up the code, and improve compatibility and maintainability.
The project started because the original Turbo Pascal Lex and Yacc did not compile well in Delphi 5+ or Kylix, the sourcecode was messy, and the last release or activity dates back to early 2000.
Download (0.21MB)
Added: 2005-12-22 License: GPL (GNU General Public License) Price:
837 downloads
imaj.at 1.1
imaj.at is a service menu for KDE to upload images to the http://imaj.at is photo upload service. more>>
imaj.at is a service menu for KDE to upload images to the http://imaj.at is photo upload service.
http://imaj.at is photo upload service and DeliPenguen(Tugrul) written a service menu for imaj.at.
cp gonder_imaj_at.desktop /usr/kde/3.5/share/apps/konqueror/
cp imaj.at.upload.py /usr/bin
<<lesshttp://imaj.at is photo upload service and DeliPenguen(Tugrul) written a service menu for imaj.at.
cp gonder_imaj_at.desktop /usr/kde/3.5/share/apps/konqueror/
cp imaj.at.upload.py /usr/bin
Download (0.002MB)
Added: 2006-12-18 License: GPL (GNU General Public License) Price:
1040 downloads
Rats! 1.12.0
Rats! is an easily extensible parser generator for C-like languages. more>>
Rats! is an easily extensible parser generator for C-like languages; though currently it only generates parsers in Java. Rats! project has been explicitly designed so that grammars are concise and easily modifiable. To this end, Rats!
- organizes grammars into modules,
- builds on parsing expression grammars instead of context-free grammars and vintegrates lexing with parsing, i.e., is scannerless,
- supports the automatic generation of abstract syntax trees,
- and provides a well-defined interface for extending parsers to recognize context-sensitive languages and formats.
Parsers generated by Rats! memoize intermediate results, which ensures linear time performance in the presence of unlimited lookahead and backtracking. As a result, they are essentially functional (even though they are implemented in an imperative language) and also called "packrat parsers."
Main features:
- Rats! relies on a module system to structure grammars and their extensions. In particular, it relies on modules to group related productions into separate units. Next, module modifications concisely express extensions to other modules and can add, change, or remove individual alternatives in productions. Finally, module parameters are used to compose modules and their extensions with each other.
- Rats! grammars build on parsing expression grammars (PEGs). While PEGs share many constructs with the familiar EBNF notation, a key difference is that they utilize ordered choices instead of the unordered choices used by context-free grammars (CFGs) and other parser generators, such as Yacc or ANTLR. As a result, Rats! grammars avoid ambiguities and support localized changes. Additional flexibility is offered through syntactic predicates, which match expressions but do not consume the input, thus providing unlimited lookahead, and through the integration of lexing with parsing, which greatly simplifies the addition of new tokens to a grammar. PEGs have the additional benefit that they are not only closed under composition (unlike the LR or LL grammars used by Yacc and ANTLR), but also intersection and complement (unlike CFGs in general).
- To eliminate the need for explicit semantic actions, Rats! can automatically generate abstract syntax trees. In particular, it supports productions that return no semantic values (such as those recognizing spaces or comments), string values (such as those recognizing literals or identifiers), and generic tree nodes (potentially all other productions).
- Since some computer-readable formats are inherently context-sensitive and cannot be expressed as PEGs (or CFGs), Rats! supports two techniques for managing parser context or state, thus providing a well-defined interface for extending parsers. First, Rats! provides parser actions to recognize expressions that depend on local context, i.e., expressions that depend on immediately preceding expressions within the same production. An example for such local context is an explicit length preceding as many instances of some expression. Second, Rats! supports a global state object to recognize expressions that depend on possibly global context. State modifications are performed within lightweight transactions, which preserve the basically functional nature of Rats!-generated parsers. An example for a global context is the symbol table used for disambiguating variable and typedef names when parsing C.
Enhancements:
- Release highlights are support for formatting-preserving source refactorings through parse trees, support for parsing and pretty printing Java 5, (an improved abstract syntax tree for Java, and improved support for type checking C and Java ASTs.
<<less- organizes grammars into modules,
- builds on parsing expression grammars instead of context-free grammars and vintegrates lexing with parsing, i.e., is scannerless,
- supports the automatic generation of abstract syntax trees,
- and provides a well-defined interface for extending parsers to recognize context-sensitive languages and formats.
Parsers generated by Rats! memoize intermediate results, which ensures linear time performance in the presence of unlimited lookahead and backtracking. As a result, they are essentially functional (even though they are implemented in an imperative language) and also called "packrat parsers."
Main features:
- Rats! relies on a module system to structure grammars and their extensions. In particular, it relies on modules to group related productions into separate units. Next, module modifications concisely express extensions to other modules and can add, change, or remove individual alternatives in productions. Finally, module parameters are used to compose modules and their extensions with each other.
- Rats! grammars build on parsing expression grammars (PEGs). While PEGs share many constructs with the familiar EBNF notation, a key difference is that they utilize ordered choices instead of the unordered choices used by context-free grammars (CFGs) and other parser generators, such as Yacc or ANTLR. As a result, Rats! grammars avoid ambiguities and support localized changes. Additional flexibility is offered through syntactic predicates, which match expressions but do not consume the input, thus providing unlimited lookahead, and through the integration of lexing with parsing, which greatly simplifies the addition of new tokens to a grammar. PEGs have the additional benefit that they are not only closed under composition (unlike the LR or LL grammars used by Yacc and ANTLR), but also intersection and complement (unlike CFGs in general).
- To eliminate the need for explicit semantic actions, Rats! can automatically generate abstract syntax trees. In particular, it supports productions that return no semantic values (such as those recognizing spaces or comments), string values (such as those recognizing literals or identifiers), and generic tree nodes (potentially all other productions).
- Since some computer-readable formats are inherently context-sensitive and cannot be expressed as PEGs (or CFGs), Rats! supports two techniques for managing parser context or state, thus providing a well-defined interface for extending parsers. First, Rats! provides parser actions to recognize expressions that depend on local context, i.e., expressions that depend on immediately preceding expressions within the same production. An example for such local context is an explicit length preceding as many instances of some expression. Second, Rats! supports a global state object to recognize expressions that depend on possibly global context. State modifications are performed within lightweight transactions, which preserve the basically functional nature of Rats!-generated parsers. An example for a global context is the symbol table used for disambiguating variable and typedef names when parsing C.
Enhancements:
- Release highlights are support for formatting-preserving source refactorings through parse trees, support for parsing and pretty printing Java 5, (an improved abstract syntax tree for Java, and improved support for type checking C and Java ASTs.
Download (0.83MB)
Added: 2007-07-19 License: LGPL (GNU Lesser General Public License) Price:
830 downloads
pyGAIM-t 0.1
pyGAIM-t is a reworking of the popular GAIM IM client to be based on the Jabber transport. more>>
pyGAIM-t is a reworking of the popular GAIM IM client to be based on the Jabber transport, which can connect to any IM system that GAIM can.
<<less Download (0.15MB)
Added: 2005-11-08 License: GPL (GNU General Public License) Price:
1445 downloads
AT Media Page 0.1.14
AT Media Page provides a simple and easy to use Plone Page which can contain ATImages. more>>
AT Media Page provides a simple and easy to use Plone Page which can contain ATImages.
<<less Download (0.019MB)
Added: 2007-05-27 License: GPL (GNU General Public License) Price:
881 downloads
Radstock 0.66
Radstock is a tool to analyse RADIUS traffic on high volume radius servers. more>>
Radstock is a tool to analyse RADIUS traffic on high volume radius servers. It has the ability to fully decode each packet, and also has extensive filters capabilities to allow you to selectively match RADIUS packets.
It provides the ability to fully decode each packet. Here is some sample output.
The key feature of radstock is its ability to filter the packets shown based on any attribute. It will also listen out for responses to matched packets and display these as well. An example filter would be (all on one line):
radstock -e "(user-name = paul or user-name = bob) and exists nas-port-id"
To compile radstock you need the following libraries:
libpcap
flex or lex
bison/yacc
Once you have these, the following three commands should do just about
all you need.
/configure
make
make install
It has been successfully compiled on Linux and Solaris
platforms. Whether it works on them is a completely different story.
<<lessIt provides the ability to fully decode each packet. Here is some sample output.
The key feature of radstock is its ability to filter the packets shown based on any attribute. It will also listen out for responses to matched packets and display these as well. An example filter would be (all on one line):
radstock -e "(user-name = paul or user-name = bob) and exists nas-port-id"
To compile radstock you need the following libraries:
libpcap
flex or lex
bison/yacc
Once you have these, the following three commands should do just about
all you need.
/configure
make
make install
It has been successfully compiled on Linux and Solaris
platforms. Whether it works on them is a completely different story.
Download (0.060MB)
Added: 2006-07-04 License: GPL (GNU General Public License) Price:
1207 downloads
at-spi 1.19.5
at-spi is the Gnome Accessibility Project. more>>
at-spi is the Gnome Accessibility Project.
Building the documentation:
Pre-built versions of the HTML documentation are available at http://developer.gnome.org/projects/gap/tech-docs/at-spi-docs/book1.html. However the documentation in the docs directory is the most up-to-date. Building the docs requires docbook and jade, see the gtk-doc package (from Gnome CVS) for more information.
Use of the AT-SPI:
Accessible applications will register with this registry service (via bonobo-activation) and adaptive/assistive technologies will register with the service as well, to indicate their interest in receiving UI events. ATs can also use the registrys services programmatically to query accessible applications.
Running the test programs:
At the moment the only clients and are two test at clients (at and simple-at). There is also a test app (app) in the tests subdirectory.
If you have a working ORBit2/bonobo-activation installation you can run the tests after adding the registryd directory to the bonobo-activation directory list with bonobo-activation-sysconf, or by installing Accessibility_Registry.server in your bonobo-activation servers directory.
You can then run ./at and ./app from the test directory, to see app register as an application, and at as a listening client. Bonobo should take care of the job of bootstrapping the registry daemon (registryd) for you. These test programs use the bonobo/CORBA C bindings directly.
<<lessBuilding the documentation:
Pre-built versions of the HTML documentation are available at http://developer.gnome.org/projects/gap/tech-docs/at-spi-docs/book1.html. However the documentation in the docs directory is the most up-to-date. Building the docs requires docbook and jade, see the gtk-doc package (from Gnome CVS) for more information.
Use of the AT-SPI:
Accessible applications will register with this registry service (via bonobo-activation) and adaptive/assistive technologies will register with the service as well, to indicate their interest in receiving UI events. ATs can also use the registrys services programmatically to query accessible applications.
Running the test programs:
At the moment the only clients and are two test at clients (at and simple-at). There is also a test app (app) in the tests subdirectory.
If you have a working ORBit2/bonobo-activation installation you can run the tests after adding the registryd directory to the bonobo-activation directory list with bonobo-activation-sysconf, or by installing Accessibility_Registry.server in your bonobo-activation servers directory.
You can then run ./at and ./app from the test directory, to see app register as an application, and at as a listening client. Bonobo should take care of the job of bootstrapping the registry daemon (registryd) for you. These test programs use the bonobo/CORBA C bindings directly.
Download (1.0MB)
Added: 2007-07-11 License: GPL (GNU General Public License) Price:
835 downloads
LLg 1.07 Alpha
LLg is a recursive descent parser generator. more>>
LLg is a recursive descent parser generator.
SYNOPSIS
use LLg;
@tokens = (
ADDOP => [-+],
LEFTP => [(],
RIGHTP => [)],
INTEGER => 0|[1-9][0-9]*,
);
$reader = Lex->new(@tokens);
$ADDOP->debug;
$expr = And->new(($factor, Any->new($ADDOP, $factor)),
sub {
shift(@_);
my $result = shift(@_);
my ($op, $integer);
while ($#_ >= 0) {
($op, $integer) = (shift(@_), shift(@_));
if ($op eq +) {
$result += $integer;
} else {
$result -= $integer;
}
}
$result;
});
$factor = Or->new($INTEGER, $parexp);
$parexp = And->new($LEFTP, $expr, $RIGHTP,
sub { $_[2] });
print STDERR "Type your arithmetic expression: ";
print "Result: ", $expr->next, "n";
Creating parsers by hand is tedious even for simple languages. This activity can be automated by parser-generators - yacc is a well-known example. But using such tools is quite demanding and requires a reasonable knowlege of the principles of syntactic analysis.
LLg is a set of Perl5 packages which allow the generation of recursive descent parsers for context-free grammars.
LLg is provided with the packages Lex and Token which are object-based. The use of these packages presupposes that you know how to write a BNF grammar and that you know (just a little) about programming in Perl.
Specifying the parser does not require any extension to Perl syntax. The specification is carried out entirely in standard Perl, be it definition of tokens, syntactic rules or associated semantic actions. LLg allows the easy specification of translation schemes, that is parsers for which the semantic action is given by actions directly associated with each production.
The packages Token and LLg allow respectively the definition of objects corresponding to terminals (tokens) and non-terminals of the grammar. Lex handles the reading and "eating" of tokens in the input stream.
Before using these packages you need to define a BNF grammar without left recursion (an LL(1) grammar). Given this, making the parser consists in:
1. create a lexical analyser by specifying the terminals,
2. create a parser (syntactic analyser) by creating a LLg object (or, more precisely, one of the packages which inherits from LLg) for each non-terminal.
3. define the semantics by associating an anonymous function with each LLg object.
Take as an example arithmetic expressions having only + and - as operators. In the Camel book we find the following grammar:
expr ::= factor { ADDOP factor }
ADDOP ::= + | -
factor ::= NUMBER | ( expr )
Creating the parser for this language involves defining a lexical analyser and a syntactic analyser.
The lexical analyser is defined thusly:
@tokens = (
ADDOP => [-+],
LEFTP => [(],
RIGHTP => [)],
INTEGER => [1-9][0-9]*,
);
$reader = Lex->new(@tokens);
The argument of the method new() is a list of pairs: the identity of the terminal and the corresponding regular expression. Each such pair leads to the creation of a terminal of type Token.
The package LLg is the base package of a set : And, Any, Do, Hook, Opt, Or. These packages allow the creation of the different types of rules normally found in context-free grammars. We use a prefix notation with the following equivalences.
A | B Or->new($A, $B) symbol A or symbol B
A B And->new($A, $B) symbol A followed by symbol B
{ A } Any->new($A) arbitrary number of A
[ A ] Opt->new($A) zero or one occurrence of A
The rules in our example are given by creating the following objects:
$expr = And->new(($factor, Any->new($ADDOP, $factor));
$factor = Or->new($NUMBER, $parexp);
$parexp = And->new($LEFTP, $expr, $RIGHTP);
The arguments of the method new() are references to LLg or Token objects. (The written order of the rule has no significance, since scalars can be references before they are assigned a value. These references are resolved when each object is used. As the example shows, references can be obtained to the objects returned by a rule.)
The semantics is defined by putting an anonymous function at the end of the list of object references. The anonymous function uses information associated with the objects. This information is transmitted by positional parameters (the array @_). The nth argument designates the result of the nth parameter of the method new(). Information returned by the function is associated with the object and is transmitted by means of positional parameters wherever the object is used. In our example we will have:
$expr = And->new(($factor, Any->new($ADDOP, $factor)),
sub {
shift(@_);
my $result = shift(@_);
my ($op, $integer);
while ($#_ >= 0) {
($op, $integer) = (shift(@_), shift(@_));
if ($op eq +) {
$result += $integer;
} else {
$result -= $integer;
}
}
$result;
});
$factor = Or->new($INTEGER, $parexp);
$parexp = And->new($LEFTP, $expr, $RIGHTP,
sub { $_[2] });
print STDERR "Type your arithmetic expression: ";
print "Result: ", $expr->next, "n";
When an integer is recognised it is returned by the anonymous function associated with the object $factor. This returned information (or, more precisely, synthesised, since it comes from a a terminal and is transmitted to non-terminals) is also available in the anonymous function associated with the object $expr. The information returned by the following object is used to calculate the value of the arithmetical expression.
The analyser is started up by applying the method next() to the axiom of the grammar:
$expr->next;
By default the input for analysis is read from the standard input. The example parser analyses and interprets individual expressions typed in at the terminal. The example calculator.pl delivered with the LLg package shows how to create an input loop allowing reading and interpretation of arbitrary many expressions.
The parser generator can be used for other purposes than the analysis of a character stream. Given that the packages Lex, LLg and Token, it is perfectly possible to define terminals which are objects i.e. instances of a class other than Token. Each new package defining terminals ought at least to have the methods status() and next() - see vonkoch.pl as an example.
<<lessSYNOPSIS
use LLg;
@tokens = (
ADDOP => [-+],
LEFTP => [(],
RIGHTP => [)],
INTEGER => 0|[1-9][0-9]*,
);
$reader = Lex->new(@tokens);
$ADDOP->debug;
$expr = And->new(($factor, Any->new($ADDOP, $factor)),
sub {
shift(@_);
my $result = shift(@_);
my ($op, $integer);
while ($#_ >= 0) {
($op, $integer) = (shift(@_), shift(@_));
if ($op eq +) {
$result += $integer;
} else {
$result -= $integer;
}
}
$result;
});
$factor = Or->new($INTEGER, $parexp);
$parexp = And->new($LEFTP, $expr, $RIGHTP,
sub { $_[2] });
print STDERR "Type your arithmetic expression: ";
print "Result: ", $expr->next, "n";
Creating parsers by hand is tedious even for simple languages. This activity can be automated by parser-generators - yacc is a well-known example. But using such tools is quite demanding and requires a reasonable knowlege of the principles of syntactic analysis.
LLg is a set of Perl5 packages which allow the generation of recursive descent parsers for context-free grammars.
LLg is provided with the packages Lex and Token which are object-based. The use of these packages presupposes that you know how to write a BNF grammar and that you know (just a little) about programming in Perl.
Specifying the parser does not require any extension to Perl syntax. The specification is carried out entirely in standard Perl, be it definition of tokens, syntactic rules or associated semantic actions. LLg allows the easy specification of translation schemes, that is parsers for which the semantic action is given by actions directly associated with each production.
The packages Token and LLg allow respectively the definition of objects corresponding to terminals (tokens) and non-terminals of the grammar. Lex handles the reading and "eating" of tokens in the input stream.
Before using these packages you need to define a BNF grammar without left recursion (an LL(1) grammar). Given this, making the parser consists in:
1. create a lexical analyser by specifying the terminals,
2. create a parser (syntactic analyser) by creating a LLg object (or, more precisely, one of the packages which inherits from LLg) for each non-terminal.
3. define the semantics by associating an anonymous function with each LLg object.
Take as an example arithmetic expressions having only + and - as operators. In the Camel book we find the following grammar:
expr ::= factor { ADDOP factor }
ADDOP ::= + | -
factor ::= NUMBER | ( expr )
Creating the parser for this language involves defining a lexical analyser and a syntactic analyser.
The lexical analyser is defined thusly:
@tokens = (
ADDOP => [-+],
LEFTP => [(],
RIGHTP => [)],
INTEGER => [1-9][0-9]*,
);
$reader = Lex->new(@tokens);
The argument of the method new() is a list of pairs: the identity of the terminal and the corresponding regular expression. Each such pair leads to the creation of a terminal of type Token.
The package LLg is the base package of a set : And, Any, Do, Hook, Opt, Or. These packages allow the creation of the different types of rules normally found in context-free grammars. We use a prefix notation with the following equivalences.
A | B Or->new($A, $B) symbol A or symbol B
A B And->new($A, $B) symbol A followed by symbol B
{ A } Any->new($A) arbitrary number of A
[ A ] Opt->new($A) zero or one occurrence of A
The rules in our example are given by creating the following objects:
$expr = And->new(($factor, Any->new($ADDOP, $factor));
$factor = Or->new($NUMBER, $parexp);
$parexp = And->new($LEFTP, $expr, $RIGHTP);
The arguments of the method new() are references to LLg or Token objects. (The written order of the rule has no significance, since scalars can be references before they are assigned a value. These references are resolved when each object is used. As the example shows, references can be obtained to the objects returned by a rule.)
The semantics is defined by putting an anonymous function at the end of the list of object references. The anonymous function uses information associated with the objects. This information is transmitted by positional parameters (the array @_). The nth argument designates the result of the nth parameter of the method new(). Information returned by the function is associated with the object and is transmitted by means of positional parameters wherever the object is used. In our example we will have:
$expr = And->new(($factor, Any->new($ADDOP, $factor)),
sub {
shift(@_);
my $result = shift(@_);
my ($op, $integer);
while ($#_ >= 0) {
($op, $integer) = (shift(@_), shift(@_));
if ($op eq +) {
$result += $integer;
} else {
$result -= $integer;
}
}
$result;
});
$factor = Or->new($INTEGER, $parexp);
$parexp = And->new($LEFTP, $expr, $RIGHTP,
sub { $_[2] });
print STDERR "Type your arithmetic expression: ";
print "Result: ", $expr->next, "n";
When an integer is recognised it is returned by the anonymous function associated with the object $factor. This returned information (or, more precisely, synthesised, since it comes from a a terminal and is transmitted to non-terminals) is also available in the anonymous function associated with the object $expr. The information returned by the following object is used to calculate the value of the arithmetical expression.
The analyser is started up by applying the method next() to the axiom of the grammar:
$expr->next;
By default the input for analysis is read from the standard input. The example parser analyses and interprets individual expressions typed in at the terminal. The example calculator.pl delivered with the LLg package shows how to create an input loop allowing reading and interpretation of arbitrary many expressions.
The parser generator can be used for other purposes than the analysis of a character stream. Given that the packages Lex, LLg and Token, it is perfectly possible to define terminals which are objects i.e. instances of a class other than Token. Each new package defining terminals ought at least to have the methods status() and next() - see vonkoch.pl as an example.
Download (0.020MB)
Added: 2007-07-16 License: Perl Artistic License Price:
830 downloads
POP3 DNS updater T.00.02
popdns is a small daemon that aims at simplifying the use of DHCP-configured machines. more>>
popdns is a small daemon that aims at simplifying the use of DHCP-configured machines by allowing them to dynamically update their DNS entry using (nearly) any POP3-capable e-mail tool.
After having configured a new e-mail source (with the POP3 protocol), users are authenticated using their system password and popdns automatically updates the specified (or implied) DNS entry with the IP address of the connecting machine.
popdns makes all DNS modifications with plugins. The plugins are external programs (scripts or compiled programs) simply launched with the following arguments:
plugin ipaddress name [ name ... ]
<<lessAfter having configured a new e-mail source (with the POP3 protocol), users are authenticated using their system password and popdns automatically updates the specified (or implied) DNS entry with the IP address of the connecting machine.
popdns makes all DNS modifications with plugins. The plugins are external programs (scripts or compiled programs) simply launched with the following arguments:
plugin ipaddress name [ name ... ]
Download (0.017MB)
Added: 2006-07-06 License: GPL (GNU General Public License) Price:
1205 downloads
Work-At-Home 1.0
The Ultimate Safe Money Guide -Free Online Money Guide Make Your Online Money The Safe Way And Generate a Daily Income Stream. The best thing I came ... more>> <<less
Download (2117KB)
Added: 2009-04-19 License: Freeware Price: Free
189 downloads
A practical lambda-calculator 2.2
A practical lambda-calculator is a Lambda-calculator with convenient commands and shortcuts. more>>
A practical lambda-calculator is a normal-order evaluator for the untyped lambda-calculus, extended with convenient commands and shortcuts to make programming in it more productive.
Shortcuts are distinguished constants that represent terms. Commands define new shortcuts, activate tracing of all reductions, compare terms modulo alpha-conversion, print all defined shortcuts and evaluation flags, etc.
Terms to evaluate and commands are entered at a read-eval-print-loop (REPL) "prompt" or "included" from a file by a special command. A Haskell branch is an embedding of the lambda calculator (as a domain-specific language) into Haskell. The calculator can be used interactively within Hugs or GHCi.
The present calculator implements what seems to be an efficient and elegant algorithm of normal order reductions. The algorithm is "more functional" than the traditionally used approach.
The algorithm seems identical to that employed by yacc sans one critical difference. The calculator also takes a more "functional" approach to the hygiene of beta-substitutions, which is achieved by coloring of identifiers where absolutely necessary. This approach is "more functional" because it avoids a global counter or the threading of the paint bucket through the whole the process. The integration of the calculator with Haskell lets us store terms in variables and easily and intuitively combine them.
The traditional recipe for normal-order reductions includes an unpleasant phrase "cook until done". The phrase makes it necessary to keep track of reduction attempts, and implies an ugly iterative algorithm. Were proposing what seems to be an efficient and elegant technique that can be implemented through intuitive re-writing rules.
Our calculator, like yacc, possesses a stack and works by doing a sequence of shift and reduce steps. The only significant difference from yacc is that the lambda-calculator "reparses" the result after the successful reduce step. The source and the target languages of our "parser" (lambda-calculator) are the same; therefore, the parser can indeed apply itself.
The parsing stack can be made implicit. In that case, the algorithm can be used for normalization of typed lambda-terms in Twelf.
The following examples show that lambda-calculus becomes a domain-specific language embedded into Haskell:
> c0 = f ^ x ^ x -- Church numeral 0
> succ = c ^ f ^ x ^ f # (c # f # x) -- Successor
> c1 = eval $ succ # c0 -- pre-evaluate other numerals
> c2 = eval $ succ # c1
> c3 = eval $ succ # c2
> c4 = eval $ succ # c3
It is indeed convenient to store terms in Haskell variables and pre-evaluate (i.e., normalize) them. They are indeed terms. We can always ask the interpreter to show the term. For example, show c4 yields (f. (x. f (f (f (f x))))).
let mul = a ^ b ^ f ^ a # (b # f) -- multiplication
eval $ mul # c1 ---> (b. b), the identity function
eval $ mul # c0 ---> (b. (f. (x. x))), which is "const 0"
These are algebraic results: multiplying any number by zero always gives zero. We can see now how lambda-calculus can be useful for theorem proving, even over universally-quantified formulas.
The calculator implements Dr. Fairbairns suggestion to limit the depth of printed terms. This makes it possible to evaluate and print some divergent terms (so-called tail-divergent terms):
Lambda_calc> let y_comb = f^((p^p#p) # (c ^ f#(c#c))) in eval $ y_comb#c
c (c (c (c (c (c (c (c (c (c (...))))))))))
It is amazing how well lambda-calculus and Haskell play together.
<<lessShortcuts are distinguished constants that represent terms. Commands define new shortcuts, activate tracing of all reductions, compare terms modulo alpha-conversion, print all defined shortcuts and evaluation flags, etc.
Terms to evaluate and commands are entered at a read-eval-print-loop (REPL) "prompt" or "included" from a file by a special command. A Haskell branch is an embedding of the lambda calculator (as a domain-specific language) into Haskell. The calculator can be used interactively within Hugs or GHCi.
The present calculator implements what seems to be an efficient and elegant algorithm of normal order reductions. The algorithm is "more functional" than the traditionally used approach.
The algorithm seems identical to that employed by yacc sans one critical difference. The calculator also takes a more "functional" approach to the hygiene of beta-substitutions, which is achieved by coloring of identifiers where absolutely necessary. This approach is "more functional" because it avoids a global counter or the threading of the paint bucket through the whole the process. The integration of the calculator with Haskell lets us store terms in variables and easily and intuitively combine them.
The traditional recipe for normal-order reductions includes an unpleasant phrase "cook until done". The phrase makes it necessary to keep track of reduction attempts, and implies an ugly iterative algorithm. Were proposing what seems to be an efficient and elegant technique that can be implemented through intuitive re-writing rules.
Our calculator, like yacc, possesses a stack and works by doing a sequence of shift and reduce steps. The only significant difference from yacc is that the lambda-calculator "reparses" the result after the successful reduce step. The source and the target languages of our "parser" (lambda-calculator) are the same; therefore, the parser can indeed apply itself.
The parsing stack can be made implicit. In that case, the algorithm can be used for normalization of typed lambda-terms in Twelf.
The following examples show that lambda-calculus becomes a domain-specific language embedded into Haskell:
> c0 = f ^ x ^ x -- Church numeral 0
> succ = c ^ f ^ x ^ f # (c # f # x) -- Successor
> c1 = eval $ succ # c0 -- pre-evaluate other numerals
> c2 = eval $ succ # c1
> c3 = eval $ succ # c2
> c4 = eval $ succ # c3
It is indeed convenient to store terms in Haskell variables and pre-evaluate (i.e., normalize) them. They are indeed terms. We can always ask the interpreter to show the term. For example, show c4 yields (f. (x. f (f (f (f x))))).
let mul = a ^ b ^ f ^ a # (b # f) -- multiplication
eval $ mul # c1 ---> (b. b), the identity function
eval $ mul # c0 ---> (b. (f. (x. x))), which is "const 0"
These are algebraic results: multiplying any number by zero always gives zero. We can see now how lambda-calculus can be useful for theorem proving, even over universally-quantified formulas.
The calculator implements Dr. Fairbairns suggestion to limit the depth of printed terms. This makes it possible to evaluate and print some divergent terms (so-called tail-divergent terms):
Lambda_calc> let y_comb = f^((p^p#p) # (c ^ f#(c#c))) in eval $ y_comb#c
c (c (c (c (c (c (c (c (c (c (...))))))))))
It is amazing how well lambda-calculus and Haskell play together.
Download (0.021MB)
Added: 2005-04-01 License: Public Domain Price:
1672 downloads
Secleted [ 0 ] software to compare
Copyright Notice:
Software piracy is theft, Using crack, password, serial numbers, registration codes, key generators is illegal and prevent future software development. The above at t yacc search only lists software in full, demo and trial versions for free download. Download links are directly from our mirror sites or publisher sites, torrent files or links from rapidshare.com, yousendit.com or megaupload.com are not allowed