Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Calling Process-run-function

44 views
Skip to first unread message

David L. Rager

unread,
Jul 12, 2005, 2:32:17 PM7/12/05
to
Hello All,

This is the simplest question I've asked yet. Would someone mind
correcting the order of my arguments to ccl:process-run-function please?

Thanks in advance,
David


(ccl:process-run-function "ACL2 'under the hood' parallelization"
:vstack-size 500000000
:tstack-size 100000000
:stack-size 100000000
(function two-arg-function)
arg1
arg2)

Reference available at:
http://www.openmcl.org/Doc/re08.html

Message has been deleted

David L. Rager

unread,
Jul 12, 2005, 2:41:54 PM7/12/05
to
Hello All,

This is the simplest question I've asked yet. Would someone mind
correcting the order of my arguments to ccl:process-run-function please?

Thanks in advance,
David


(ccl:process-run-function "my process's name"

Pascal Bourguignon

unread,
Jul 12, 2005, 3:36:28 PM7/12/05
to

Syntax is usually specified under the form of a grammar.

A grammar is a 4-uple (T,NT,S,R).

T is a set of Terminal tokens. In lisp, they are the number, the
strings, the symbols, the vectors, etc, and the parentheses, the dot,
the coma, the quote, the backquote, etc.

NT is a set of Non Terminal symbols (grammar symbols). They're used
to name parts of sentences.

S is the Start symbol, an element of NT. All the sentences in the
language can be derived from this Start symbol using the rules in R,
until all the items are elements of T.

R is the set of production Rules. R is a subset of (NT U T)* × (NT U T)*.
The notation E* denotes the union of all the sets: {}, E, E×E, E×E×E,
E×E×E×E, etc.

To simply a little, restrictions are added to the kind of production
rules. For example, to make a context free grammar, we accept as left
hand side for the rules only elements of NT:
R is a subset of NT × (NT U T)*.


Now, there are several notations and deviations for the rules and to
distinguish between terminals and non terminals. But knowing that
little of the grammar theory you should be able to identify what is
what and understand what you're reading.

terminals: 'x' x <b>x</b> ;; x in bold
non terminals: <X> X <i>x</i> ;; x in italic
rules: lhs ::= rhs .
lhs --> rhs .
lhs :: rhs .
lhs : rhs ; ;; etc, everyone likes to invent
;; his own syntax...

Moreover, there are notations to coalesce several rules. For example
the three rules:

<Name> ::= 'cat' .
<Name> ::= 'dog' .
<Name> ::= 'fish' .

can be written as:

<Name> ::= 'cat' | 'dog' | 'fish' .


Now, starting from the Start symbol, we use rules to rewrite the
sentence, substituting a part of the sentence that matches the left
hand side of one of the rule by the right hand side of that rule.
Repeat while there is a Non Terminal in the sentence. This generates
a sentence in the language defined by this grammar. The analysis,
parsing, does the reverse: starting from a sentence (a sequence of
Terminal tokens), try to find a tree of rule substitutions with the
Start symbol as root.


Now, the Syntax: section of lisp documentation reads like:

process-run-function process-specifier function &rest args => process

process-specifier :: name | ( &key name persistent priority class stack-size
vstack-size tstack-size )


The first line is only part of a right hand side of a rule. We could
invent a Non Terminal: process-run-function-call, and deduce this
implicit rule:

process-run-function-call ::= '(' 'process-run-function' process-specifier
function '&rest' args ')' . [1]

The "=> process" trailer gives some semantic information about the
function, irrelevant to its syntax.

process-specifier, function and args are Non Terminals. To make a
real call to process-run-function you need to substitute them and
replace them by the rhs of one of their grammar rules.

process-specifier :: name | ( &key name persistent priority class stack-size
vstack-size tstack-size )
speficies actually two grammar rules:

process-specifier ::= name .
process-specifier ::= '(' &key name persistent priority class stack-size
vstack-size tstack-size ')' .


&key and &rest don't belong to the grammar. We can get rid of them
considering them to be Non Terminals and adding two production rules:

&key ::= empty .
&rest ::= empty .

name, persistent, priority, class, stack-size, vstack-size, and
tstack-size are Non Terminals. The two occurences of names are not
actually the same Non Terminal:

process-specifier ::= name-1 . [2]
process-specifier ::= '(' &key name-2 persistent priority class stack-size
vstack-size tstack-size ')' . [3]

For the first name, it's indicated that it's a string. We have the
grammar rule:

name-1 ::= string .

The grammar rules corresponding to the other Non Terminal are not
explicited, (they're described generically in the sections about the
keyword parameters), but are like:

name-2 ::= empty .
name-2 ::= ':name' expression .
persistent ::= empty .
persistent ::= ':persistent' expression .
etc.

So, assuming you start from the Start symbol Program, we may generate
a process-run-function call with the following derivations:

Program
|
| applying the production rule: Program ::= Expression .
v
Expression
|
| applying the production rule: Expression ::= Function-Call .
v
Function-Call
|
| applying the production rule: Function-Call ::= process-run-function-call
v
process-run-function-call
|
| applying the production rule: [1]
v
'(' 'process-run-function' process-specifier function '&rest' args ')'
|
| applying the production rule: &rest ::= empty .
v
'(' 'process-run-function' process-specifier function args ')'
|
| applying the production rule: [3]
v
'(' 'process-run-function' '(' '&key' name-2 persistent priority
class stack-size vstack-size tstack-size ')'
function args ')'
|
| applying the production rule: &key ::= empty .
v
'(' 'process-run-function' '(' name-2 persistent priority
class stack-size vstack-size tstack-size ')'
function args ')'
|
| applying the production rule: name-2 ::= ':name' expression .
v
'(' 'process-run-function' '(' ':name' expression persistent priority
class stack-size vstack-size tstack-size ')'
function args ')'
|
| applying the production rule: persistent ::= empty .
v
'(' 'process-run-function' '(' ':name' expression priority
class stack-size vstack-size tstack-size ')'
function args ')'
|
| applying the production rule: priority ::= empty .
v
'(' 'process-run-function' '(' ':name' expression
class stack-size vstack-size tstack-size ')'
function args ')'
|
| applying the production rule: class ::= empty .
v
'(' 'process-run-function' '(' ':name' expression
stack-size vstack-size tstack-size ')'
function args ')'
|
| applying the production rule: stack-size ::= ':stack-size' expression .
v
'(' 'process-run-function' '(' ':name' expression
':stack-size' expression vstack-size tstack-size ')'
function args ')'
|
| applying the production rule: vstack-size ::= ':vstack-size' expression .
v
'(' 'process-run-function' '(' ':name' expression
':stack-size' expression ':vstack-size' expression tstack-size ')'
function args ')'
|
| applying the production rule: tstack-size ::= ':tstack-size' expression .
v
'(' 'process-run-function' '(' ':name' expression
':stack-size' expression ':vstack-size' expression
':tstack-size' expression ')' function args ')'
|
etc, let's substitute the various expressions
|
v
'(' 'process-run-function' '(' ':name' '"my process's name"'
':stack-size' '100000000' ':vstack-size' '500000000'
':tstack-size' '100000000' ')' function args ')'
|
| applying the production rule: function ::= '(' 'function' symbol ')' .
v
'(' 'process-run-function' '(' ':name' '"my process's name"'
':stack-size' '100000000' ':vstack-size' '500000000'
':tstack-size' '100000000' ')' '(' 'function' symbol ')' args ')'
|
| applying the production rule: symbol ::= 'two-arg-function' .
v
'(' 'process-run-function' '(' ':name' '"my process's name"'
':stack-size' '100000000' ':vstack-size' '500000000'
':tstack-size' '100000000' ')' '(' 'function' 'two-arg-function' ')' args ')'
|
| applying the production rule: args ::= expression args .
v
'(' 'process-run-function' '(' ':name' '"my process's name"'
':stack-size' '100000000' ':vstack-size' '500000000'
':tstack-size' '100000000' ')' '(' 'function' 'two-arg-function' ')'
expression args ')'
|
| applying the production rule: args ::= expression args .
v
'(' 'process-run-function' '(' ':name' '"my process's name"'
':stack-size' '100000000' ':vstack-size' '500000000'
':tstack-size' '100000000' ')' '(' 'function' 'two-arg-function' ')'
expression expression args ')'
|
| applying the production rule: args ::= empty .
v
'(' 'process-run-function' '(' ':name' '"my process's name"'
':stack-size' '100000000' ':vstack-size' '500000000'
':tstack-size' '100000000' ')' '(' 'function' 'two-arg-function' ')'
expression expression ')'
|
etc, let's substitute the various expressions
|
v
'(' 'process-run-function' '(' ':name' '"my process's name"'
':stack-size' '100000000' ':vstack-size' '500000000'
':tstack-size' '100000000' ')' '(' 'function' 'two-arg-function' ')'
arg1 arg2 ')'

Now, we can generate the tokens into a lexable character sequence
(lexable according the rules of the lisp lexer):

(process-run-function (:name "my process's name"
:stack-size 100000000
:vstack-size 500000000
:tstack-size 100000000)
(function'two-arg-function) arg1 arg2)

Et voilà: a program perfectly valid syntax-wise.


--
__Pascal Bourguignon__ http://www.informatimago.com/
Litter box not here.
You must have moved it again.
I'll poop in the sink.

David L. Rager

unread,
Jul 12, 2005, 3:49:15 PM7/12/05
to Pascal Bourguignon
Wow - that's quite the explanation. For some dumb reason it never
occurred to me to think of the argument lists as grammars. Thanks!

It turns out that I also need to quote the first argument list - not
sure why. The one other person I asked how to do this replied with the
same end solution, so maybe it's just an OpenMCL thing....

(process-run-function '(:name "my process's name"
:stack-size 100000000
:vstack-size 500000000
:tstack-size 100000000)
(function'two-arg-function) arg1 arg2)

Et voilà: a program perfectly valid syntax-wise.

Thanks,
David

Pascal Bourguignon

unread,
Jul 12, 2005, 4:18:08 PM7/12/05
to
"David L. Rager" <rag...@cs.utexas.edu> writes:

> Wow - that's quite the explanation. For some dumb reason it never
> occurred to me to think of the argument lists as grammars. Thanks!
>
> It turns out that I also need to quote the first argument list - not
> sure why. The one other person I asked how to do this replied with the
> same end solution, so maybe it's just an OpenMCL thing....

Well, I overlooked this. It's a function, not a macro, so indeed the
process specifier is evaluated as well as the other arguments.

> (process-run-function '(:name "my process's name"
> :stack-size 100000000
> :vstack-size 500000000
> :tstack-size 100000000)
> (function'two-arg-function) arg1 arg2)

Oops! ^ remove this quote too!

> Et voilà: a program perfectly valid syntax-wise.

Note that it's a case where you can use backquote and comma if you
want to use vairables:

(process-run-function `(:name ,name
:stack-size ,stack-size
:vstack-size ,(* 5 stack-size)
:tstack-size ,stack-size)
(function two-arg-function) arg1 arg2)

--
__Pascal Bourguignon__ http://www.informatimago.com/

Small brave carnivores
Kill pine cones and mosquitoes
Fear vacuum cleaner

GP lisper

unread,
Jul 13, 2005, 4:00:31 PM7/13/05
to
On 13 Jul 2005 08:48:38 -0700, <gil...@snapdragon.csl.sri.com> wrote:
>
> Pascal Bourguignon wrote:
>> Syntax is usually specified under the form of a grammar....
>
> You have *way* too much time on your hands!!! :-)

And I thank him for that time. I have a much better understanding
what someone citing 'grammar' means now.


--
LOOP :: a Domain Specific Language.

Fred Gilham

unread,
Jul 13, 2005, 11:48:38 AM7/13/05
to

Pascal Bourguignon wrote:
> Syntax is usually specified under the form of a grammar....

You have *way* too much time on your hands!!! :-)

--
Fred Gilham gil...@csl.sri.com
I can see you're going to do just *fine* here in comp.lang.lisp. I'm
rather looking forward to the ritual disembowelling, in particular,
although the bit were we chop your arms and legs off and feed them to
crocodiles is also good. --- Tim Bradshaw

0 new messages