Commit a9ebbf6b authored by Michael Hanus 's avatar Michael Hanus
Browse files

Directory curry2prolog renamed to src, defaulting improved

parent b673255a
......@@ -26,7 +26,7 @@ pakcsinitrc
# intermediate files
*.bak
make.log
curry2prolog/pakcsversion.pl
src/pakcsversion.pl
docs/src/version.tex
docs/src/tooldocs/casc/curry-style-guide.html
lib/
......@@ -37,10 +37,10 @@ scripts/makesavedstate
*.state
bin/
cpns/CPNSD
curry2prolog/prologbasics.pl
curry2prolog/libsicstus
curry2prolog/libswi
curry2prolog/pakcs
src/prologbasics.pl
src/libsicstus
src/libswi
src/pakcs
tools/Peval/peval
tools/coosy/CoosyGUI
tools/curry2xml
......
......@@ -144,7 +144,7 @@ two system files and install your system as follows:
1. Change the definition of the constant `maxTupleArity` in the files
`pakcshome/frontend/curry-frontend/src/Generators/GenFlatCurry.hs`
and `pakcshome/curry2prolog/compiler.pl`
and `pakcshome/src/compiler.pl`
according to your required maximal arity.
2. Delete the file `pakcshome/lib/Prelude.fcy`.
3. Re-install PAKCS by `make`.
......
Performing IO actions in curry2java:
- an I/O action contained in a data structure or in a locally declared
variable is performed only once even it is applied several times.
This effect is due to sharing.
Example for this behavior:
iotest = act >> act
where act = putStrLn "hello!"
Here, hello is printed only once.
Solution: no sharing of results of type IO a
Occur check in higher-order objects in curry2prolog:
- no occur check is performed in curry2prolog in higher-order objects,
Occur check in higher-order objects in PAKCS:
- no occur check is performed in PAKCS in higher-order objects,
i.e., in partially applied functions (which are considered as
constructors). Thus, the unification
......
......@@ -91,8 +91,8 @@ CURRYDOC := $(shell which curry-doc)
# Executable of the markdown translator (required for documentation generation):
MD2PDF := $(shell which md2pdf)
# The version information file for Curry2Prolog:
C2PVERSION=$(ROOT)/curry2prolog/pakcsversion.pl
# The version information file for PAKCS:
PAKCSVERSION=$(ROOT)/src/pakcsversion.pl
# The version information file for the manual:
MANUALVERSION=$(DOCDIR)/src/version.tex
......@@ -162,9 +162,9 @@ kernel: scripts copylibs copytools
$(MAKE) frontend
# pre-compile all libraries:
@cd lib && $(MAKE) fcy
# build the Curry2Prolog compiler as a saved system:
$(MAKE) $(C2PVERSION)
cd curry2prolog && $(MAKE)
# build the PAKCS compiler as a saved system:
$(MAKE) $(PAKCSVERSION)
cd src && $(MAKE)
# compile all libraries:
@cd lib && $(MAKE) acy
# compile optimization tools:
......@@ -248,8 +248,8 @@ manual:
@if [ -d $(DOCDIR)/src -a $(DISTPKGINSTALL) = "no" -a -x "$(CURRYDOC)" -a -x "$(MD2PDF)" ] ; then \
$(MAKE) $(MANUALVERSION) && cd $(DOCDIR)/src && $(MAKE) install ; fi
# Create file with version information for Curry2Prolog:
$(C2PVERSION): Makefile
# Create file with version information for PAKCS:
$(PAKCSVERSION): Makefile
echo ':- module(pakcsversion,[compilerVersion/1, compilerMajorVersion/1, compilerMinorVersion/1, compilerRevisionVersion/1, buildVersion/1, buildDate/1, buildDir/1, pkgInstallDir/1]).' > $@
echo "compilerVersion('PAKCS$(MAJORVERSION).$(MINORVERSION)')." >> $@
echo 'compilerMajorVersion($(MAJORVERSION)).' >> $@
......@@ -337,7 +337,7 @@ clean: $(CLEANCURRY)
# Clean the generated PAKCS tools
.PHONY: cleantools
cleantools: $(CLEANCURRY)
cd curry2prolog && $(MAKE) clean
cd src && $(MAKE) clean
cd currytools && $(MAKE) uninstall
cd tools && $(MAKE) clean
cd bin && rm -f pakcs
......
......@@ -27,7 +27,7 @@ This directory contains:
A directory containing various executables
to execute the components of PAKCS.
`curry2prolog`:
`src`:
This directory contains the compiler from Curry into Prolog which
is the basis of the main component of PAKCS: the interactive
development environment.
......
PAKCS: Release Notes
====================
Release notes for PAKCS Version 2.0.0 (October 20, 2017)
Release notes for PAKCS Version 2.0.0 (October 31, 2017)
--------------------------------------------------------
This version has almost the same functionality as version 1.15.0
......@@ -12,6 +12,8 @@ this version contains the following changes:
* `define` command removed (since it was based on a quite restricted parser)
* Free variable mode (option `+free`) removed since it has many restrictions
and is no longer compatible with type classes.
* Sources of compiler are contained in directory `src` (instead of
`curry2prolog` as in versions 1.x).
* Some libraries removed since they are available as packages
which can easily be installed via `cpm`:
......
......@@ -3,42 +3,42 @@ Upstream-Name: PAKCS
Upstream-Contact: Michael Hanus <mh@informatik.uni-kiel.de>
Source: https://git.ps.informatik.uni-kiel.de/curry/pakcs
Files: curry2prolog/Makefile
curry2prolog/c2p.pl
curry2prolog/evaluator.pl
curry2prolog/loader.pl
curry2prolog/lib_src/prim_clpb.pl
curry2prolog/lib_src/prim_readshowterm.pl
curry2prolog/lib_src/prim_chr.pl
curry2prolog/lib_src/prim_dynamic.pl
curry2prolog/lib_src/prim_globalvar.pl
curry2prolog/lib_src/prim_unsafe.pl
curry2prolog/lib_src/prim_ioexts.pl
curry2prolog/lib_src/prim_socket.pl
curry2prolog/lib_src/prim_system.pl
curry2prolog/lib_src/prim_time.pl
curry2prolog/lib_src/prim_distribution.pl
curry2prolog/lib_src/prim_directory.pl
curry2prolog/lib_src/prim_standard.pl
curry2prolog/lib_src/prim_float.pl
curry2prolog/lib_src/prim_clpfd.pl
curry2prolog/lib_src/prim_profile.pl
curry2prolog/lib_src/prim_ports.pl
curry2prolog/lib_src/prim_global.pl
curry2prolog/lib_src/prim_io.pl
curry2prolog/lib_src/prim_plprofiledata.pl
curry2prolog/lib_src/prim_flat.pl
curry2prolog/lib_src/prim_clpr.pl
curry2prolog/swibasics.pl
curry2prolog/version.pl
curry2prolog/readXml.pl
curry2prolog/compiler.pl
curry2prolog/block2freeze.pl
curry2prolog/sicstusbasics.pl
curry2prolog/sicstus_processing.pl
curry2prolog/external.pl
curry2prolog/readFlcFromFcy.pl
curry2prolog/basics.pl
Files: src/Makefile
src/c2p.pl
src/evaluator.pl
src/loader.pl
src/lib_src/prim_clpb.pl
src/lib_src/prim_readshowterm.pl
src/lib_src/prim_chr.pl
src/lib_src/prim_dynamic.pl
src/lib_src/prim_globalvar.pl
src/lib_src/prim_unsafe.pl
src/lib_src/prim_ioexts.pl
src/lib_src/prim_socket.pl
src/lib_src/prim_system.pl
src/lib_src/prim_time.pl
src/lib_src/prim_distribution.pl
src/lib_src/prim_directory.pl
src/lib_src/prim_standard.pl
src/lib_src/prim_float.pl
src/lib_src/prim_clpfd.pl
src/lib_src/prim_profile.pl
src/lib_src/prim_ports.pl
src/lib_src/prim_global.pl
src/lib_src/prim_io.pl
src/lib_src/prim_plprofiledata.pl
src/lib_src/prim_flat.pl
src/lib_src/prim_clpr.pl
src/swibasics.pl
src/version.pl
src/readXml.pl
src/compiler.pl
src/block2freeze.pl
src/sicstusbasics.pl
src/sicstus_processing.pl
src/external.pl
src/readFlcFromFcy.pl
src/basics.pl
docs/src/Makefile
docs/src/libraries.tex
docs/src/overview.tex
......
bin usr/lib/pakcs/
curry2prolog usr/lib/pakcs/
currytools usr/lib/pakcs/
docs usr/lib/pakcs/
examples usr/lib/pakcs/
......@@ -11,6 +10,7 @@ README usr/lib/pakcs/
RELNOTES.txt usr/lib/pakcs/
RESOURCES.html usr/lib/pakcs/
scripts usr/lib/pakcs/
src usr/lib/pakcs/
testsuite usr/lib/pakcs/
tools usr/lib/pakcs/
bin/cleancurry usr/lib/pakcs/bin/
......@@ -62,7 +62,7 @@ with arity $n$ has the form
\end{curry}
where \code{lib} is the Prolog library (stored in the directory of the
Curry module or in the global directory
\code{\cyshome/curry2prolog/lib_src}) containing the code implementing this
\code{\cyshome/src/lib_src}) containing the code implementing this
function and \code{pred} is a predicate name in this library
implementing this function. Note that the function $f$ must be
declared in module \code{Mod}: either as an external function
......@@ -194,7 +194,7 @@ complex structures).
The Prolog code implementing the external functions must be accessible to the run-time
system of \CYS by putting it into the directory containing the corresponding
Curry module or into the system directory
\code{\cyshome/curry2prolog/lib_src}.
\code{\cyshome/src/lib_src}.
Then it will be automatically loaded into the run-time environment
of each compiled Curry program.
......
......@@ -4,10 +4,10 @@ most of these programs are contained in the file "index.html".
Further useful files:
CPTEST: a shell script to test the curry2prolog system.
In order to test the system after some modifications, run
test.sh: a shell script to test PAKCS.
In order to test the system after some modifications, run
> ./CPTEST
> ./test.sh
This shell commands run a couple of tests and report the
difference to previous executions.
......@@ -60,30 +60,30 @@ start_phil i =
Shell commands to start all semaphores:
echo ':l philo_ext
start_room' | curry2prolog &
start_room' | pakcs &
echo ':l philo_ext
start_fork0' | curry2prolog &
start_fork0' | pakcs &
echo ':l philo_ext
start_fork1' | curry2prolog &
start_fork1' | pakcs &
echo ':l philo_ext
start_fork2' | curry2prolog &
start_fork2' | pakcs &
echo ':l philo_ext
start_fork3' | curry2prolog &
start_fork3' | pakcs &
echo ':l philo_ext
start_fork4' | curry2prolog &
start_fork4' | pakcs &
Shell commands to start all philosophers (after starting the semaphores!):
echo ':l philo_ext
start_phil 0' | curry2prolog &
start_phil 0' | pakcs &
echo ':l philo_ext
start_phil 1' | curry2prolog &
start_phil 1' | pakcs &
echo ':l philo_ext
start_phil 2' | curry2prolog &
start_phil 2' | pakcs &
echo ':l philo_ext
start_phil 3' | curry2prolog &
start_phil 3' | pakcs &
echo ':l philo_ext
start_phil 4' | curry2prolog &
start_phil 4' | pakcs &
-}
......@@ -2,16 +2,16 @@
# script to start all semaphores for the dining philosophers:
echo ':l philo_ext
start_room' | curry2prolog &
start_room' | pakcs &
echo ':l philo_ext
start_fork0' | curry2prolog &
start_fork0' | pakcs &
echo ':l philo_ext
start_fork1' | curry2prolog &
start_fork1' | pakcs &
echo ':l philo_ext
start_fork2' | curry2prolog &
start_fork2' | pakcs &
echo ':l philo_ext
start_fork3' | curry2prolog &
start_fork3' | pakcs &
echo ':l philo_ext
start_fork4' | curry2prolog &
start_fork4' | pakcs &
# now you can start the philosophers
......@@ -104,7 +104,7 @@ if [ $PKGFOUND = yes -a $USECPM = yes ] ; then
exec "$0" cypm exec "$0" --nocypm ${1+"$@"}
fi
REPL="$PAKCSHOME/curry2prolog/pakcs"
REPL="$PAKCSHOME/src/pakcs"
if [ ! -x "$REPL" ] ; then
echo "ERROR: executable '$REPL' not found!" >&2
echo "Run: cd $PAKCSHOME && make" >&2
......
......@@ -431,20 +431,16 @@ flatType2Atom(Type,CurryType) :-
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Check whether the first argument is the (FlatCurry) representation
% of some class contexts and return the context type in the second
% argument and the class name (string) in the third argument:
classDict(T,_,_) :- var(T), !, fail.
classDict('TCons'(FCDict,[A]),A,Dict) :-
% argument and the qualified class name (string) in the third (module)
% and fourth (class name) argument:
classDict(T,_,_,_) :- var(T), !, fail.
classDict('TCons'(FCDict,[A]),A,ModS,DictS) :-
atomic2Atom(FCDict,FCDictA), % hack for SWI 7.x if FCDict == []
atom_codes(FCDictA,FCDictS),
% dictionary argument types are prefixed by "_Dict#":
atom_codes('._Dict\'23',FCDictPrefixS),
append(ModFCDictPrefixS,DictS,FCDictS),
append(ModS,FCDictPrefixS,ModFCDictPrefixS), !,
atom_codes(ModA,ModS),
currentModuleFile(CurrMod,_),
((ModA='Prelude' ; ModA=CurrMod)
-> Dict = DictS
; append(ModS,[46|DictS],Dict)),
!.
append(ModS,FCDictPrefixS,ModFCDictPrefixS), !.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
......@@ -572,8 +568,8 @@ defaultTypeExpr(OrgType,DfltType,DfltTypeAtom) :-
% try to default overloaded numerical types:
defaultNumType(Type,Type) :- var(Type), !.
defaultNumType('FuncType'(AType,RType),DType) :-
classDict(AType,TVar,DictName),
member(DictName,["Num","Integral","Fractional"]), !,
classDict(AType,TVar,ModName,DictName),
ModName="Prelude", member(DictName,["Num","Integral","Fractional"]), !,
(DictName="Fractional"
-> (var(TVar) -> TVar = 'TCons'('Prelude.Float',[]) ; true),
defaultNumType(RType,DType)
......@@ -586,8 +582,9 @@ defaultNumType(Type,Type).
% remove type class context of defaulted types:
removeDefaultedTypes(Type,Type) :- var(Type), !.
removeDefaultedTypes('FuncType'(AType,RType),DType) :-
classDict(AType,TVar,DictName),
member(DictName,["Eq","Ord","Show"]),
classDict(AType,TVar,ModName,DictName),
ModName="Prelude",
member(DictName,["Eq","Ord","Read","Show"]),
nonvar(TVar), !,
removeDefaultedTypes(RType,DType).
removeDefaultedTypes('FuncType'(AType,RType),'FuncType'(AType,DType)) :- !,
......@@ -596,7 +593,7 @@ removeDefaultedTypes(Type,Type).
% Is the type overloaded, i.e., does it contain class dictioniary parameters?
isOverloadedType(Type) :- var(Type), !, fail.
isOverloadedType('FuncType'(AType,_)) :- classDict(AType,_,_), !.
isOverloadedType('FuncType'(AType,_)) :- classDict(AType,_,_,_), !.
isOverloadedType('FuncType'(_,RType)) :- !, isOverloadedType(RType).
isOverloadedType(_) :- fail.
......@@ -1253,7 +1250,7 @@ createSavedState(ProgPl,ProgState,InitialGoal) :-
appendAtom(ProgPl,'.save',TmpSavePl),
tell(TmpSavePl),
installDir(PH),
appendAtom(PH,'/curry2prolog/',PHCP),
appendAtom(PH,'/src/',PHCP),
appendAtom(PHCP,'prologbasics.pl',PrologBasicsPl),
appendAtom(PHCP,'basics.pl',BasicsPl),
appendAtom(PHCP,'evaluator.pl',EvalPl),
......@@ -1608,27 +1605,32 @@ writeType(T) :- writeTypeWithClassContext(T).
% write standard type contexts in their source form, if possible:
writeTypeWithClassContext('FuncType'(C1,'FuncType'(C2,T))) :-
classDict(C1,A1,Cls1Name),
classDict(C2,A2,Cls2Name), !,
classDict(C1,A1,Mod1Name,Cls1Name),
classDict(C2,A2,Mod2Name,Cls2Name), !,
write('('),
writeClassContext(Cls1Name,A1), write(', '),
writeClassContext(Cls2Name,A2),
writeClassContext(Mod1Name,Cls1Name,A1), write(', '),
writeClassContext(Mod2Name,Cls2Name,A2),
writeTypeWithRemainingClassContexts(T).
writeTypeWithClassContext('FuncType'(C,T)) :-
classDict(C,A,ClsName), !,
writeClassContext(ClsName,A), write(' => '),
classDict(C,A,ModName,ClsName), !,
writeClassContext(ModName,ClsName,A), write(' => '),
writeType(T,top).
writeTypeWithClassContext(T) :- writeType(T,top).
writeTypeWithRemainingClassContexts('FuncType'(C,T)) :-
classDict(C,A,ClsName), !, write(', '),
writeClassContext(ClsName,A),
classDict(C,A,ModName,ClsName), !, write(', '),
writeClassContext(ModName,ClsName,A),
writeTypeWithRemainingClassContexts(T).
writeTypeWithRemainingClassContexts(T) :-
write(') => '),
writeType(T,top).
writeClassContext(ClsName,A) :-
writeClassContext(ModName,ClsName,A) :-
atom_codes(ModN,ModName),
currentModuleFile(CurrMod,_),
((ModN='Prelude' ; ModN=CurrMod)
-> true % don't print module prefix if prelude or current module
; write(ModN), write('.')),
atom_codes(ClsN,ClsName), write(ClsN), write(' '), writeType(A,nested).
% the second argument is 'top' or 'nested':
......
......@@ -449,7 +449,7 @@ profileRedo(P) :-
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% write a (Prolog) term in Curry syntax:
% (used in curry2prolog for printing results or during debugging)
% (used in PAKCS for printing results or during debugging)
writeCurry(T) :- writeCurryOnStream(user_output,T).
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment