[system] / trunk / pg / lib / Parser.pm Repository:
ViewVC logotype

Log of /trunk/pg/lib/Parser.pm

Parent Directory Parent Directory


Links to HEAD: (view) (download) (as text) (annotate)
Sticky Revision:

Revision 3374 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Wed Jul 13 01:46:49 2005 UTC (14 years, 4 months ago) by dpvc
File length: 24487 byte(s)
Diff to previous 3370
Wrong correction in the previous commit.  Use CODE::push

Revision 3370 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Tue Jul 12 22:29:53 2005 UTC (14 years, 4 months ago) by dpvc
File length: 24482 byte(s)
Diff to previous 3369
A first pass at making parser error messages localizable.  The
Context()->{error}{msg} hash can be used to specify translations of
the standard messages.  For example,

    Context()->{error}{msg}{'Division by zero'} = "Don't divide by zero, dude!";
    Context()->{error}{msg}{'Function '%s' has too many inputs'} =
        "You passed too many arguments to '%s'";

(I didn't translate into another language, here, but you could do
that, too.)

The msg hash could also be used within answer checkers to make certain
answer messages more appropriate for the given type of expected answer.

Revision 3369 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Tue Jul 12 21:05:37 2005 UTC (14 years, 4 months ago) by dpvc
File length: 24389 byte(s)
Diff to previous 3352
Fixed various perl compiler warnings (due to extra "my", and so on).

Revision 3352 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Tue Jul 5 01:38:19 2005 UTC (14 years, 5 months ago) by dpvc
File length: 24388 byte(s)
Diff to previous 2985
Modified the perl() method to make calles to Value:: directly rather
than to the main:: stubs for creating Value objects.  This will make
it work better from within packages or when Parser.pl hasn't been
loaded.

A few things still won't work in this case; e.g., calls to Closed()
for intervals (these could be handled better using ->with()) and to
functions like Factorial and log10 that are defined in Parser.pl.

Finally, there should be better object-based control over what
routines are called to create these objects, so that subclasses of the
Value objects will be able to be generated correctly.

Revision 2985 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Wed Nov 3 22:39:21 2004 UTC (15 years, 1 month ago) by dpvc
File length: 24377 byte(s)
Diff to previous 2969
Fixed a bug in processing absolute values with implicit
multiplication.

Revision 2969 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Tue Nov 2 01:55:21 2004 UTC (15 years, 1 month ago) by dpvc
File length: 24197 byte(s)
Diff to previous 2823
Fixed typo in a comment.

Revision 2823 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Thu Sep 23 21:09:14 2004 UTC (15 years, 2 months ago) by dpvc
File length: 24196 byte(s)
Diff to previous 2803
Fixed Parser so that you can replace the Formula class as well as the
other object types.

Revision 2803 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Sun Sep 19 15:11:08 2004 UTC (15 years, 2 months ago) by dpvc
File length: 24161 byte(s)
Diff to previous 2798
The $Parser::class variable was being handled after the "use"
statements at the end, so had to put a BEGIN around it.

Revision 2798 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Sun Sep 19 11:29:06 2004 UTC (15 years, 2 months ago) by dpvc
File length: 24131 byte(s)
Diff to previous 2796
Make Formula()->eval return a Real (ie, aValue::Real object) rather
than a perl number.  That way, you can use $f->eval->cmp rather than
needing Real($f->eval)->cmp, and so on.

Also make Formula()->perl do the same, for consistency.

(This could have been accomplished by having the Parser::Number class
evaluate to a Real, but for efficiency during computation, we put
off making the Real object until the end.  It probably doesn't make
that big a difference, but every little bit helps.)

Revision 2796 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Sun Sep 19 01:15:03 2004 UTC (15 years, 2 months ago) by dpvc
File length: 24034 byte(s)
Diff to previous 2682
Added flags that control the reductions performed by
Formula()->reduce.  Each reduction operation can be individually
enabled or disabled in the context, and in the reduce() call itself.

More complex reductions need to be developed.

Revision 2682 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Tue Aug 24 03:36:54 2004 UTC (15 years, 3 months ago) by dpvc
File length: 23971 byte(s)
Diff to previous 2678
Fixed a bug with  sin^2 x  that introduced when I adjusted the
error report for implied multiplication.

Revision 2678 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Mon Aug 23 23:55:37 2004 UTC (15 years, 3 months ago) by dpvc
File length: 23898 byte(s)
Diff to previous 2676
Modified the parser so that the classes for the various object
constructors are stored in the context table rather than hard-coded
into the parser.  That way, you can override the default classes with
your own.  This gives you even more complete control to modify the
parser.  (You had been able to replace the definitions of operators,
functions and list-like objects, but could not override the behaviour
of numbers, strings, variables, and so on.  Now you can.)

This effects most of the files, but only by changing the name of the
calls that create the various objects.

There are also a couple of other minor fixes.

Revision 2676 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Mon Aug 23 05:00:16 2004 UTC (15 years, 3 months ago) by dpvc
File length: 23569 byte(s)
Diff to previous 2673
Better highlighting for syntax error involving implied
multiplication.  (No highlighted had been done in the past.)

Revision 2673 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Mon Aug 23 01:21:27 2004 UTC (15 years, 3 months ago) by dpvc
File length: 23376 byte(s)
Diff to previous 2664
Moved WW-specific routines from Parser.pm to WeBWorK.pm.
Changed error reporting when the error message was not generated by
the parser directly.  (The stack trace and line number references are
removed before the error is reported.)

Revision 2664 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Sat Aug 21 22:02:14 2004 UTC (15 years, 3 months ago) by dpvc
File length: 24219 byte(s)
Diff to previous 2660
Added a file to perform WeBWorK-specific modifications to the
Parser/Value packages.  (I've tried to make these independent of
WeBWorK, so you can use them in other perl code if you want to.)

The parameters for fuzzy reals and some of the other parameters now
are taken from the pg->{ansEvalDefaults} values (as defined in
global.conf or course.conf).  More still needs to be done with this,
however.

Revision 2660 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Fri Aug 20 15:52:32 2004 UTC (15 years, 3 months ago) by dpvc
File length: 24242 byte(s)
Diff to previous 2657
A number of adjustments to get negative infinities to work better.
They used to be stored as separate Parser strings, but now they are
flagged versions of a single string.

All of the problems are really due to the fact that there is no
Infinity class in the Parser (only a Value version).  That should be
changed, but will require some work, and can be put off for now.

It would be best if the classes within the two packages would match up
nearly 1-to-1, but for historical reasons, they don't.  Since the
introduction of Real, String and Infinity classes to the Value
package, The Infinity class is the one main difference between the
two, and once that is fixed, everything needs to be looked over to
check for unnecessary complications due to the historical lack of classes
in one or the other package.

Revision 2657 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Fri Aug 20 11:13:51 2004 UTC (15 years, 3 months ago) by dpvc
File length: 24150 byte(s)
Diff to previous 2650
Handle trapped error messages that are not produced by the parser
error reporter (i.e., by bugs within the parser itself).  Also added
an error if implied multiplication is attempted when the operator for
it is not defined in the current context.

Revision 2650 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Thu Aug 19 14:23:00 2004 UTC (15 years, 3 months ago) by dpvc
File length: 23865 byte(s)
Diff to previous 2628
Added Parser::Number::NoDecimals() function that causes the parser to
give an error message when the student types a decimal number.  This
means the student must enter fractions as fractions, or values like
sqrt(2) or pi/4 symbolically not numerically.

Revision 2628 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Mon Aug 16 21:41:05 2004 UTC (15 years, 3 months ago) by dpvc
File length: 23726 byte(s)
Diff to previous 2611
Allow parser "constants" to be (in reality) formulas.  That way, for
example, you can defined T, N and B to be the formulas for the unit
tangent, normal and binormal of a space curve (as functions of "t")
and the student can write anwers in terms of T, N and B (without
having to compute them).

You could have created FUNCTIONS T(t), N(t) and B(t), and added them
to the parser to get almost the same effect, but the students would
have had to include the "(t)".  (If you want that, go ahead and do it
that way.)

Revision 2611 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Sat Aug 14 15:59:35 2004 UTC (15 years, 3 months ago) by dpvc
File length: 23828 byte(s)
Diff to previous 2609
Fixed a typo in one of the parser answer checkers.  Added a line that
was incorrecctly removed in the parser.

Revision 2609 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Sat Aug 14 13:54:52 2004 UTC (15 years, 3 months ago) by dpvc
File length: 23722 byte(s)
Diff to previous 2605
Added a String type to the Value package.  Mostly this is to make it
possible to generate an answer checker for it that uses the parser.
It also makes it more consistent for handling things like stringify,
especially when they are recursively called internally.

Added new default strings "NONE" and "DNE", since these get used a
lot.

Modified how the default parameters are set up for the answer
checkers, and how the answer checker reports the expected answer type
in type mismatch error messages.

Revision 2605 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Sat Aug 14 02:50:18 2004 UTC (15 years, 3 months ago) by dpvc
File length: 23742 byte(s)
Diff to previous 2592
Incorporated infinities into Parser package better.  They have been
stored as String objects (with extra data) in the parser, and I've
left it that way, but now they convert to/from Vallue::Infinity
objects correctly, and these are used for generating the output.

Also added the Infinity answer checker, and adjusted the error
messages produces by type mismatches in the answer checkers and
elsewhere.

Revision 2592 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Thu Aug 12 16:40:47 2004 UTC (15 years, 3 months ago) by dpvc
File length: 23860 byte(s)
Diff to previous 2579
A number of small fixes.  Most were to fix minor bugs in string and
TeX output, particulary for the various list-based objects (like
vectors, intervals, etc.).  There were also some bug fixes in the
comparison routines.  Some additional checks were added for valid
intervals when the coordinates are formulas.

Revision 2579 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Mon Aug 9 21:38:01 2004 UTC (15 years, 4 months ago) by dpvc
File length: 23043 byte(s)
Diff to previous 2576
Significant update to new parser.

New features include:

  Better control over format of vector output (you can now
    specify ijk-format rather than <...> format)

  "Fuzzy" reals, where the relations like == return true when the
    two values are "close enough".  (This is controlable using
    parameters similar to those used in NUM_CMP).

  The fuzzy reals are now used in vectors/points/matrices/complexes/intervals
    and so on so that their relations will also be fuzzy.  E.g.,
    (1E-13,2) == (0,3) will be true, and norm(Vector(0,1E-13)) will
    equal 0.

  The two main portions of the parser (the Parser and Value packages)
    now share a common context object for configuration purposes.

Revision 2576 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Wed Aug 4 20:52:28 2004 UTC (15 years, 4 months ago) by dpvc
File length: 22971 byte(s)
Diff to previous 2558
Make Parser work with PGauxiliaryFunctions.pl, and add the macro files
needed to initialize the parser.

Revision 2558 - (view) (download) (as text) (annotate) - [select for diffs]
Added Wed Jul 28 20:32:33 2004 UTC (15 years, 4 months ago) by sh002i
File length: 22708 byte(s)
merged changes from rel-2-1-a1 -- stop using that branch.

This form allows you to request diffs between any two revisions of this file. For each of the two "sides" of the diff, enter a numeric revision.

  Diffs between and
  Type of Diff should be a

Sort log by:

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9