Upcoming change to version 3

Let the developers know what you think of the software and what can be done to either improve the CFDG language or the Context Free program.

Moderators: MtnViewJohn, chris, mtnviewmark

Post Reply
User avatar
MtnViewJohn
Site Admin
Posts: 882
Joined: Fri May 06, 2005 2:26 pm
Location: Mountain View, California
Contact:

Upcoming change to version 3

Post by MtnViewJohn »

Right now version 3 allows numeric parameters be take any form. This means that context-sensitive grammars can be written. I am thinking of resolving this by splitting numeric parameters into two types: real-valued, and integer (actually natural numbers).

Real-valued parameters will keep the type name 'number' and will have three allowed expressions: any constant expression, a random number within a constant range, or an in-coming parameter.

Integer parameters will get the type name 'natural' and will allow any expression that meets the meets the requirements in the Wikipedia page on primitive recursive functions. There will be new expression operators and functions to support the primitive recursion requirement:
  • proper subtraction operator that returns zero is the subtraction is negative. probably will be '--'
  • factorial() function, too lazy to make it an operator
  • divides() predicate function, or maybe an operator
  • div(a,b) function, returns natural quotient of two natural numbers, rounding down
  • exponentiation involving two integers will be done in the integer domain, not using the pow() function
  • the mod() function on integer arguments will work in the integer domain
  • sg() function
  • min() and max() functions
  • isPrime() predicateMark beat me up on this one
  • abs() function will have two argument form that returns the absolute different between the arguments
  • loop index variables will be natural numbers if the loop limits are natural numbers and the loop step is an integer (step can be negative)
ETA - There will be some way to turn off natural number checking and allow any expression in rule parameters. But you will have to admit that you are doing something bad.

User avatar
MtnViewJohn
Site Admin
Posts: 882
Joined: Fri May 06, 2005 2:26 pm
Location: Mountain View, California
Contact:

Re: Upcoming change to version 3

Post by MtnViewJohn »

I'm relaxing the requirement for real-valued parameters. Now they can either be an incoming parameter or any expression that is not dependent on an incoming parameter. Expressions that depend on incoming parameters are not allowed, but anything else is ok.

A new configuration parameter, CF_IMPURE, has been defined. By default, CF_IMPURE = 0, which means that natural and real-valued parameters are checked for legality. If your cfdg file has

Code: Select all

CF_IMPURE = 1
then legality checks for natural and numeric parameters are turned off.

Post Reply