Commit de79b8b5 authored by Michael Hanus 's avatar Michael Hanus

Parser options updated

parent ba2ef664
......@@ -58,7 +58,7 @@ at the beginning of the source program.
For instance, in order to use default rules in a Curry program,
one has to put the line
\begin{curry}
{-# OPTIONS_CYMAKE -F --pgmF=currypp --optF=defaultrules #-}
{-# OPTIONS_FRONTEND -F --pgmF=currypp --optF=defaultrules #-}
\end{curry}
at the beginning of the program.
This option tells the \CYS front end to process the Curry source program
......@@ -78,7 +78,7 @@ For instance, in order to use integrated code and default rules
in a module and store the transformed program,
one has to put the line
\begin{curry}
{-# OPTIONS_CYMAKE -F --pgmF=currypp --optF=foreigncode --optF=defaultrules --optF=-o #-}
{-# OPTIONS_FRONTEND -F --pgmF=currypp --optF=foreigncode --optF=defaultrules --optF=-o #-}
\end{curry}
at the beginning of the program.
%
......@@ -86,11 +86,11 @@ If the options about the kind of preprocessing is omitted,
all kinds of preprocessing
are applied. Thus, the preprocessor directive
\begin{curry}
{-# OPTIONS_CYMAKE -F --pgmF=currypp #-}
{-# OPTIONS_FRONTEND -F --pgmF=currypp #-}
\end{curry}
is equivalent to
\begin{curry}
{-# OPTIONS_CYMAKE -F --pgmF=currypp --optF=foreigncode --optF=defaultrules --optF=contracts #-}
{-# OPTIONS_FRONTEND -F --pgmF=currypp --optF=foreigncode --optF=defaultrules --optF=contracts #-}
\end{curry}
......@@ -113,7 +113,7 @@ Curry expressions.
For this purpose, the program containing this code must start with
the preprocessing directive
\begin{curry}
{-# OPTIONS_CYMAKE -F --pgmF=currypp --optF=foreigncode #-}
{-# OPTIONS_FRONTEND -F --pgmF=currypp --optF=foreigncode #-}
\end{curry}
%
The next sections describe the currently supported foreign languages.
......@@ -133,7 +133,7 @@ For instance, the following module defines a predicate
to check whether a string is a valid identifier:
\begin{curry}
{-# OPTIONS_CYMAKE -F --pgmF=currypp --optF=foreigncode #-}
{-# OPTIONS_FRONTEND -F --pgmF=currypp --optF=foreigncode #-}
import RegExp
......@@ -156,7 +156,7 @@ For instance, the following program defines an operation
that formats a string, an integer (with leading sign and zeros),
and a float with leading sign and precision 3:
\begin{currynomath}
{-# OPTIONS_CYMAKE -F --pgmF=currypp --optF=foreigncode #-}
{-# OPTIONS_FRONTEND -F --pgmF=currypp --optF=foreigncode #-}
import Data.Format
......@@ -193,7 +193,7 @@ into these HTML syntax, these Curry expressions must be enclosed
in curly brackets.
The following example program shows its use:
\begin{curry}
{-# OPTIONS_CYMAKE -F --pgmF=currypp --optF=foreigncode #-}
{-# OPTIONS_FRONTEND -F --pgmF=currypp --optF=foreigncode #-}
import HTML
......@@ -220,7 +220,7 @@ The following simple example, taken from \cite{Hanus01PADL},
shows the use of this feature:
\begin{currynomath}
{-# OPTIONS_CYMAKE -F --pgmF=currypp --optF=foreigncode #-}
{-# OPTIONS_FRONTEND -F --pgmF=currypp --optF=foreigncode #-}
import HTML
......@@ -257,7 +257,7 @@ and XML expressions (\code{XmlExp}) can be included by enclosing
them in curly and double curly brackets, respectively.
The following example program shows its use:
\begin{currynomath}
{-# OPTIONS_CYMAKE -F --pgmF=currypp --optF=foreigncode #-}
{-# OPTIONS_FRONTEND -F --pgmF=currypp --optF=foreigncode #-}
import HTML
......@@ -542,7 +542,7 @@ The path to the info file is passed as a parameter prefixed by
\ccode{--model:} to the Curry preprocessor, e.g., by the preprocessor
directive
\begin{curry}
{-# OPTIONS_CYMAKE -F --pgmF=currypp --optF=--model:$\ldots$/Uni_SQLCode.info #-}
{-# OPTIONS_FRONTEND -F --pgmF=currypp --optF=--model:$\ldots$/Uni_SQLCode.info #-}
\end{curry}
\item
The info file is placed in the same directory as the Curry source file
......@@ -687,7 +687,7 @@ As a simple example, we show the implementation of the
previous example for sequential rules with a default rule:
%
\begin{curry}
{-# OPTIONS_CYMAKE -F --pgmF=currypp --optF=defaultrules #-}
{-# OPTIONS_FRONTEND -F --pgmF=currypp --optF=defaultrules #-}
mlookup key (_ ++ [(key,value)] ++ _) = Just value
mlookup'default _ _ = Nothing
......@@ -701,7 +701,7 @@ since it is easier to characterize the unsafe positions
of the queens on the chessboard (see the first rule of \code{safe}):
%
\begin{curry}
{-# OPTIONS_CYMAKE -F --pgmF=currypp --optF=defaultrules #-}
{-# OPTIONS_FRONTEND -F --pgmF=currypp --optF=defaultrules #-}
import Combinatorial(permute)
import Integer(abs)
......@@ -760,7 +760,7 @@ with a postcondition and a specification
(where the code for \code{sorted} and \code{perm} is not shown here):
%
\begin{curry}
{-# OPTIONS_CYMAKE -F --pgmF=currypp --optF=contracts #-}
{-# OPTIONS_FRONTEND -F --pgmF=currypp --optF=contracts #-}
$\ldots$
......
{-# OPTIONS_CYMAKE -F --pgmF=currypp --optF=defaultrules --optF=contracts #-}
{-# OPTIONS_FRONTEND -F --pgmF=currypp --optF=defaultrules --optF=contracts #-}
import Test.Prop
......
{-# OPTIONS_CYMAKE -F --pgmF=currypp #-}
{-# OPTIONS_CYMAKE -Wnone #-}
{-# OPTIONS_FRONTEND -F --pgmF=currypp #-}
{-# OPTIONS_FRONTEND -Wnone #-}
-- Example for using integrated code, default rules, and contracts in one
-- module
......
{-# OPTIONS_CYMAKE -F --pgmF=currypp --optF=contracts #-}
{-# OPTIONS_FRONTEND -F --pgmF=currypp --optF=contracts #-}
import Test.Prop
......
{-# OPTIONS_CYMAKE -F --pgmF=currypp --optF=contracts #-}
{-# OPTIONS_FRONTEND -F --pgmF=currypp --optF=contracts #-}
-- Defining factorial numbers:
......
{-# OPTIONS_CYMAKE -F --pgmF=currypp --optF=contracts #-}
{-# OPTIONS_FRONTEND -F --pgmF=currypp --optF=contracts #-}
-- Fibonacci numbers specified by traditional recursive definition
-- and computed efficiently by an infinite list.
......
{-# OPTIONS_CYMAKE -F --pgmF=currypp --optF=contracts #-}
{-# OPTIONS_FRONTEND -F --pgmF=currypp --optF=contracts #-}
import Test.Prop
......
{-# OPTIONS_CYMAKE -F --pgmF=currypp --optF=contracts #-}
{-# OPTIONS_FRONTEND -F --pgmF=currypp --optF=contracts #-}
-- straight selection sort with specification
import Control.SetFunctions
......
{-# OPTIONS_CYMAKE -F --pgmF=currypp --optF=contracts --optF=-e #-}
{-# OPTIONS_FRONTEND -F --pgmF=currypp --optF=contracts --optF=-e #-}
-- Example for a postcondition with a nondeterministic definition:
por True _ = True
......
{-# OPTIONS_CYMAKE -F --pgmF=currypp --optF=contracts #-}
{-# OPTIONS_CYMAKE -Wnone #-}
{-# OPTIONS_FRONTEND -F --pgmF=currypp --optF=contracts #-}
{-# OPTIONS_FRONTEND -Wnone #-}
import Test.Prop
......
{-# OPTIONS_CYMAKE -F --pgmF=currypp --optF=contracts --optF=-e #-}
{-# OPTIONS_FRONTEND -F --pgmF=currypp --optF=contracts --optF=-e #-}
-- Implementation of quicksort with partition
-- Use option "-e" for contract wrapper (see part'post below).
......
{-# OPTIONS_CYMAKE -F --pgmF=currypp --optF=defaultrules #-}
{-# OPTIONS_FRONTEND -F --pgmF=currypp --optF=defaultrules #-}
import Test.Prop
......
{-# OPTIONS_CYMAKE -F --pgmF=currypp --optF=defaultrules #-}
{-# OPTIONS_FRONTEND -F --pgmF=currypp --optF=defaultrules #-}
import Test.Prop
import Control.SetFunctions
......
{-# OPTIONS_CYMAKE -F --pgmF=currypp --optF=defaultrules #-}
{-# OPTIONS_CYMAKE -Wnone #-}
{-# OPTIONS_FRONTEND -F --pgmF=currypp --optF=defaultrules #-}
{-# OPTIONS_FRONTEND -Wnone #-}
import Test.Prop
......
{-# OPTIONS_CYMAKE -F --pgmF=currypp --optF=defaultrules #-}
{-# OPTIONS_FRONTEND -F --pgmF=currypp --optF=defaultrules #-}
import Test.Prop
......
{-# OPTIONS_CYMAKE -F --pgmF=currypp --optF=defaultrules #-}
{-# OPTIONS_FRONTEND -F --pgmF=currypp --optF=defaultrules #-}
import Test.Prop
......
{-# OPTIONS_CYMAKE -F --pgmF=currypp --optF=defaultrules #-}
{-# OPTIONS_FRONTEND -F --pgmF=currypp --optF=defaultrules #-}
import Test.Prop
......
{-# OPTIONS_CYMAKE -F --pgmF=currypp --optF=defaultrules #-}
{-# OPTIONS_CYMAKE -Wnone #-}
{-# OPTIONS_FRONTEND -F --pgmF=currypp --optF=defaultrules #-}
{-# OPTIONS_FRONTEND -Wnone #-}
import Test.Prop
......
{-# OPTIONS_CYMAKE -F --pgmF=currypp --optF=defaultrules --optF=-o #-}
{-# OPTIONS_CYMAKE -Wnone #-}
{-# OPTIONS_FRONTEND -F --pgmF=currypp --optF=defaultrules --optF=-o #-}
{-# OPTIONS_FRONTEND -Wnone #-}
-- This example shows that optimal evaluation is still possible
-- with default rules.
......
{-# OPTIONS_CYMAKE -F --pgmF=currypp --optF=defaultrules #-}
{-# OPTIONS_CYMAKE -Wnone #-}
{-# OPTIONS_FRONTEND -F --pgmF=currypp --optF=defaultrules #-}
{-# OPTIONS_FRONTEND -Wnone #-}
import Test.Prop
......
{-# OPTIONS_CYMAKE -F --pgmF=currypp --optF=defaultrules #-}
{-# OPTIONS_FRONTEND -F --pgmF=currypp --optF=defaultrules #-}
import Test.Prop
......
{-# OPTIONS_CYMAKE -F --pgmF=currypp --optF=defaultrules #-}
{-# OPTIONS_CYMAKE -Wnone #-}
{-# OPTIONS_FRONTEND -F --pgmF=currypp --optF=defaultrules #-}
{-# OPTIONS_FRONTEND -Wnone #-}
import Test.Prop
......
{-# OPTIONS_CYMAKE -F --pgmF=currypp --optF=defaultrules #-}
{-# OPTIONS_CYMAKE -Wnone #-}
{-# OPTIONS_FRONTEND -F --pgmF=currypp --optF=defaultrules #-}
{-# OPTIONS_FRONTEND -Wnone #-}
import Test.Prop
......
{-# OPTIONS_CYMAKE -F --pgmF=currypp --optF=defaultrules #-}
{-# OPTIONS_CYMAKE -Wnone #-}
{-# OPTIONS_FRONTEND -F --pgmF=currypp --optF=defaultrules #-}
{-# OPTIONS_FRONTEND -Wnone #-}
import Test.Prop
......
{-# OPTIONS_CYMAKE -F --pgmF=currypp --optF=defaultrules #-}
{-# OPTIONS_CYMAKE -Wnone #-}
{-# OPTIONS_FRONTEND -F --pgmF=currypp --optF=defaultrules #-}
{-# OPTIONS_FRONTEND -Wnone #-}
import Test.Prop
......
{-# OPTIONS_CYMAKE -F --pgmF=currypp --optF=defaultrules #-}
{-# OPTIONS_CYMAKE -Wnone #-}
{-# OPTIONS_FRONTEND -F --pgmF=currypp --optF=defaultrules #-}
{-# OPTIONS_FRONTEND -Wnone #-}
import Test.Prop
......
{-# OPTIONS_CYMAKE -F --pgmF=currypp --optF=defaultrules #-}
{-# OPTIONS_FRONTEND -F --pgmF=currypp --optF=defaultrules #-}
import Test.Prop
......
{-# OPTIONS_CYMAKE -F --pgmF=currypp --optF=defaultrules #-}
{-# OPTIONS_FRONTEND -F --pgmF=currypp --optF=defaultrules #-}
import Test.Prop
......
{-# OPTIONS_CYMAKE -F --pgmF=currypp --optF=defaultrules #-}
{-# OPTIONS_FRONTEND -F --pgmF=currypp --optF=defaultrules #-}
import Test.Prop
......
{-# OPTIONS_CYMAKE -F --pgmF=currypp --optF=foreigncode #-}
{-# OPTIONS_FRONTEND -F --pgmF=currypp --optF=foreigncode #-}
------------------------------------------------------------------------------
--- This program contains some examples for integrated code to format strings.
......
{-# OPTIONS_CYMAKE -F --pgmF=currypp --optF=foreigncode #-}
{-# OPTIONS_FRONTEND -F --pgmF=currypp --optF=foreigncode #-}
------------------------------------------------------------------------------
--- This program contains examples for integrated code to support
......
{-# OPTIONS_CYMAKE -F --pgmF=currypp --optF=foreigncode #-}
{-# OPTIONS_FRONTEND -F --pgmF=currypp --optF=foreigncode #-}
------------------------------------------------------------------------------
--- This program contains some examples for using different kinds of
......
{-# OPTIONS_CYMAKE -F --pgmF=currypp --optF=foreigncode #-}
{-# OPTIONS_FRONTEND -F --pgmF=currypp --optF=foreigncode #-}
------------------------------------------------------------------------------
--- This program contains some examples for integrated code to support
......
{-# OPTIONS_CYMAKE -F --pgmF=currypp --optF=foreigncode #-}
{-# OPTIONS_FRONTEND -F --pgmF=currypp --optF=foreigncode #-}
------------------------------------------------------------------------------
-- Example for CGI programming in Curry:
......
{-# OPTIONS_CYMAKE -F --pgmF=currypp --optF=foreigncode --optF=-o #-}
{-# OPTIONS_FRONTEND -F --pgmF=currypp --optF=foreigncode --optF=-o #-}
------------------------------------------------------------------------------
--- This program contains examples for integrated code to support
......
{-# OPTIONS_CYMAKE -F --pgmF=currypp --optF=foreigncode #-}
{-# OPTIONS_FRONTEND -F --pgmF=currypp --optF=foreigncode #-}
------------------------------------------------------------------------------
--- This program contains some examples for integrated code to support
......
{-# OPTIONS_CYMAKE -F --pgmF=currypp --optF=foreigncode #-}
{-# OPTIONS_FRONTEND -F --pgmF=currypp --optF=foreigncode #-}
------------------------------------------------------------------------------
--- This program contains tests for integrated code to support
......
{-# OPTIONS_CYMAKE -F --pgmF=currypp --optF=foreigncode #-}
{-# OPTIONS_FRONTEND -F --pgmF=currypp --optF=foreigncode #-}
------------------------------------------------------------------------------
--- This program contains some tests for integrated code to support
......
{-# OPTIONS_CYMAKE -F --pgmF=currypp --optF=foreigncode #-}
{-# OPTIONS_FRONTEND -F --pgmF=currypp --optF=foreigncode #-}
--- Test module for integration of SQL:
--- Checking whether the preprocessor detects errors
......
{-# OPTIONS_CYMAKE -F --pgmF=currypp --optF=foreigncode #-}
{-# OPTIONS_FRONTEND -F --pgmF=currypp --optF=foreigncode #-}
--- test module for integration of SQL
--- using currypp
......
{-# OPTIONS_CYMAKE -F --pgmF=currypp --optF=foreigncode #-}
{-# OPTIONS_FRONTEND -F --pgmF=currypp --optF=foreigncode #-}
--- Test module for integration of SQL:
--- Testing also insert/update/delete operations
......
{-# OPTIONS_CYMAKE -F --pgmF=currypp --optF=foreigncode #-}
{-# OPTIONS_FRONTEND -F --pgmF=currypp --optF=foreigncode #-}
--- Test module for integration of SQL
......
......@@ -32,7 +32,7 @@
--- Springer LNCS 10137, pp. 1-18, 2017
---
--- This preprocessor can be invoked by the Curry preprocessor `currypp`
--- with the option `defaultrules` (provided as a CYMAKE option,
--- with the option `defaultrules` (provided as a FRONTEND option,
--- see the example programs in the directory `examples/DefaultRules`).
---
--- @author Michael Hanus
......
......@@ -5,7 +5,7 @@
--- @version February 2015
------------------------------------------------------------------------------
{-# OPTIONS_CYMAKE -Wno-missing-signatures -Wno-incomplete-patterns #-}
{-# OPTIONS_FRONTEND -Wno-missing-signatures -Wno-incomplete-patterns #-}
module MLParser (lex,layout,parse) where
......
......@@ -5,7 +5,7 @@
--- @version July 2017
------------------------------------------------------------------------------
{-# OPTIONS_CYMAKE -Wno-missing-signatures -Wno-incomplete-patterns #-}
{-# OPTIONS_FRONTEND -Wno-missing-signatures -Wno-incomplete-patterns #-}
module RegexParser(parse) where
......
......@@ -7,7 +7,7 @@
--- is supported (option `foreigncode`, see module `Translator`).
---
--- @author Michael Hanus
--- @version December 2020
--- @version January 2021
------------------------------------------------------------------------------
import Control.Monad ( when )
......@@ -264,7 +264,7 @@ pathToModName currypath psf =
| dir `isPrefixOf` pp = drop (length dir + 1) pp
| otherwise = tryRemovePathPrefix dirs pp
-- Replace OPTIONS_CYMAKE line containing currypp call
-- Replace OPTIONS_FRONTEND / OPTIONS_CYMAKE line containing currypp call
-- in a source text by blank line (to avoid recursive calls):
replaceOptionsLine :: String -> String
replaceOptionsLine = unlines . map replOptLine . lines
......@@ -273,11 +273,13 @@ replaceOptionsLine = unlines . map replOptLine . lines
then " "
else s
-- Is this a OPTIONS_CYMAKE comment line?
-- Is this an OPTIONS_FRONTEND or OPTIONS_CYMAKE comment line?
isOptionLine :: String -> Bool
isOptionLine s = "{-# OPTIONS_CYMAKE " `isPrefixOf` dropWhile isSpace s -- -}
isOptionLine s =
"{-# OPTIONS_CYMAKE " `isPrefixOf` dropWhile isSpace s ||
"{-# OPTIONS_FRONTEND " `isPrefixOf` dropWhile isSpace s -- -}
-- Extract all OPTIONS_CYMAKE lines:
-- Extract all OPTIONS_FRONTEND / OPTIONS_CYMAKE lines:
optionLines :: String -> String
optionLines = unlines . filter isOptionLine . lines
......
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