Grammar for WebSim (short Comments)
Credits ::= { } // print the credits.
DisplayList ::= { ( [ embed ] [ ( IntExp [ , ] IntExp [ , ] // List of displays.
IntExp [ , ] IntExp ) ] <Display> )* }
FindBNF ::= { (( filename <string>) | // Create a file summarizing the grammar of WebSim.
( classes <string>) |
( html <boolean>) |
( summary <boolean>) |
( width1 expression.IntExp) |
( width2 expression.IntExp) |
( width3 expression.IntExp) |
( width4 expression.IntExp))* }
ProjWin ::= [ embed ] [ ( IntExp [ , ] IntExp [ , ] IntExp // Window for a single Project.
[ , ] ) IntExp] <Project>
Random ::= { } // A random number generator.
ShowEdit ::= { (( trigger <string>) | // Show variables.
( freq expression.IntExp) |
( all <string>) |
( vars { pointer.PString+ } ))* }
ShowThreads ::= // Show all threads in a window.
TestMatrix ::= // Test the Matrix object.
Title ::= { (( title <string>) | // Title on a Display.
( display <Display>))* }
WebSim ::= { (( showUnparse <boolean>) | // WebSim.
( autosave <boolean>) |
( autosaveTime expression.NumExp) |
( autosaveFilename <string>) |
( makeBackup <boolean>) |
( appendTime <boolean>) |
( projects { ProjWin+ } ))* }
expression.IntExp ::= NumVarExp // A constant integer expression.
expression.IntVarExp ::= NumVarExp // An integer expression.
expression.NumExp ::= NumVarExp // A constant numeric expression.
expression.NumVarExp ::= NumVarTerm (( + | - ) NumVarTerm )* // A numeric expression.
expression.NumVarFact ::= <integer> | // A factor used by NumVarExp.
<double> |
- NumVarFact |
( ( NumVarExp ) ) |
( floor ( NumVarExp ) ) |
( ceil ( NumVarExp ) ) |
( mod ( NumVarExp ) ) |
( power ( NumVarExp ) ) |
( sqrt ( NumVarExp ) ) |
( ln ( NumVarExp ) ) |
( log10 ( NumVarExp ) ) |
( exp ( NumVarExp ) ) |
( sin ( NumVarExp ) ) |
( cos ( NumVarExp ) ) |
( tan ( NumVarExp ) ) |
( asin ( NumVarExp ) ) |
( acos ( NumVarExp ) ) |
( atan ( NumVarExp ) ))
expression.NumVarTerm ::= NumVarFact (( * | / ) NumVarTerm )* // A product or ratio used by NumVarExp.
matrix.Matrix ::= ( ( [ [(NumExp [ , ])* NumExp] ] ) | // A matrix or vector.
( [ ( [ [(NumExp [ , ])* NumExp] ] [ , ])*
( [ [(NumExp [ , ])* NumExp] ] ) ] ))
[ transpose ]
picture.Animation ::= ( ( first NumExp) | // The frames of an Animation.
( last NumExp) |
( frames IntExp) )* <picture.PicPipe>
picture.Antialias ::= jitter ( true | // Antialias each pixel.
false ) raysX IntExp raysY IntExp raysZ
IntExp raysT IntExp
picture.ColorMap ::= picture.ColorMapEntry + // linearly-interpolated mapping from double to color.
picture.ColorMapEntry ::= [ NumExp [ , ] picture.ColorVector ] // one line of a color map.
picture.ColorVector ::= < NumExp [ , ] NumExp [ , ] NumExp [ [ , ] // A single color.
NumExp [ , ] NumExp ] >
picture.Description ::= <string> // A string describing the picture being drawn.
picture.Edges ::= IntExp // Trace figure edges.
picture.Gallery ::= { picture.PicPipePipeline * } // A list of pictures to tile.
picture.PicPipePipeline ::= { picture.PicPipe * } // A Picture pipeline.
picture.Picture ::= { (( bar expression.IntExp) | // Draw a bitmapped, antialiased image.
( pass1 picture.PicPipePipeline) |
( pass2 picture.PicPipePipeline) |
( bothPasses picture.PicPipePipeline))* }
picture.Region ::= ( NumExp [ , ] NumExp ) [ , ] ( NumExp [ , ] // A region to zoom into.
NumExp )
picture.RndColor ::= [ picture.ColorVector ] // Random colors.
picture.TimebombFractal ::= // Timebomb fractal.
picture.ValueMap ::= picture.ValueMapEntry + // Piecewise linear function.
picture.ValueMapEntry ::= [ NumExp [ , ] NumExp ] // One line of a value map.
picture.directFractal ::= // fractal circles
.Fract1
picture.directFractal ::= // a fractal maze (CS110 cover)
.Maze
pointer.PDouble ::= <double>
pointer.PInt ::= <integer>
pointer.PObject ::= { }
pointer.PString ::= <string> // a string in single quotes
sim.ForExperiment ::= { (( initVal expression.NumExp) | // Repeats an Experiment like a FOR loop.
( finalVal expression.NumExp) |
( increment expression.NumExp) |
( variable <string>) |
( experiment <sim.Experiment>))* }
sim.Simulator ::= { (( experiment <sim.Experiment>) | // run a simulation.
( displays DisplayList))* }
sim.TDLambda ::= { (( mdp <sim.mdp.MDP>) | // TD(lambda).
( funApp <sim.funApp.FunApp>) |
( incremental <boolean>) |
( rate expression.NumExp) |
( smooth expression.NumExp) |
( tolerance expression.NumExp) |
( gamma expression.NumExp) |
( explore expression.NumExp) |
( expDecay expression.NumExp) |
( lambda expression.NumExp) |
( dt expression.NumExp) |
( seed expression.IntExp))* }
sim.data.Dot ::= // Always generates the vector (.
sim.data.OnesRnd ::= { numOutputs IntExp } // Random vector of ones and random numbers.
sim.data.RemoteTable ::= { download <boolean> location <string> // downloads a remote table of records and converts
filename <string> inputs (IntExp [ , ])+ // to input/output vectors for training.
outputs (IntExp [ , ])+ ( ( savefile <boolean>)
| ( cacheFilename <string>) | ( username
<string>) |
( password <string>) |
( normalize IntExp IntExp) |
( nullAttribute IntExp) |
( unparseTable <boolean>) )* }
sim.data.RndCircle ::= // Points on a circle.
sim.data.RndDisk ::= // Points in a circle.
sim.data.RndOnes ::= IntExp // Create random vectors with this many elements.
sim.data.RndUniformLine ::= // random numbers on a line.
sim.data.RndUniformSquare ::= // Points in a square.
sim.data.SpiralData ::= { numSpirals NumExp } // Random points around a spiral within the [-1,1]
// square.
sim.data.Table ::= { ( Matrix Matrix )* } // table of input/output vectors for training.
sim.data.XOR ::= // 2 input 1 output XOR data
sim.display.Contour ::= { (( function <sim.funApp.FunApp>) | // Contour plot.
( contours expression.IntExp) |
( spectrum <boolean>) |
( color pointer.PMatrix) |
( trigger <string>) |
( freq expression.IntExp) |
( xElement expression.IntExp) |
( xSamples expression.IntExp) |
( yElement expression.IntExp) |
( ySamples expression.IntExp) |
( zElement expression.IntExp) |
( zMin expression.NumExp) |
( zMax expression.NumExp))* }
sim.display.Graph2D ::= { (( trigger <string>) | // 2D plot.
( freq expression.IntExp) |
( xMin expression.NumExp) |
( xMax expression.NumExp) |
( yMin expression.NumExp) |
( yMax expression.NumExp) |
( color pointer.PMatrix) |
( flicker <boolean>) |
( showNumbers <boolean>) |
( propZoom <boolean>) |
( squareView <boolean>) |
( plots { <sim.display.Plot>+ } ))* }
sim.display.Graph3D ::= { (( flicker <boolean>) | // 3D surface plot.
( rotateX expression.NumExp) |
( rotateY expression.NumExp) |
( rotateZ expression.NumExp) |
( trigger <string>) |
( freq expression.IntExp) |
( xSamples expression.IntExp) |
( ySamples expression.IntExp) |
( xMin expression.NumExp) |
( xMax expression.NumExp) |
( yMin expression.NumExp) |
( yMax expression.NumExp) |
( xMinNow expression.NumExp) |
( xMaxNow expression.NumExp) |
( yMinNow expression.NumExp) |
( yMaxNow expression.NumExp) |
( zMin expression.NumExp) |
( zMax expression.NumExp) |
( xElement expression.IntExp) |
( yElement expression.IntExp) |
( zElement expression.IntExp) |
( function <sim.funApp.FunApp>) |
( plotFloor <boolean>) |
( plotTop <boolean>) |
( floorColor pointer.PMatrix) |
( topColor pointer.PMatrix) |
( bottomColor pointer.PMatrix) |
( plots { <sim.display.Plot>+ } ) |
( inputs pointer.PMatrix) |
( heightRatio expression.NumExp))* }
sim.display.Grid ::= { (( size expression.NumExp) | // Regular grid.
( type expression.IntExp))* }
sim.display.PlotXY ::= { (( freq expression.IntExp) | // //Autoscaling 2D plot.
( size expression.IntExp) |
( ring <boolean>) |
( logX <boolean>) |
( logY <boolean>) |
( drawLines <boolean>) |
( drawBoxes <boolean>) |
( drawSymbols <boolean>) |
( symbolType expression.IntExp) |
( symbolSize expression.IntExp) |
( avg2 expression.IntExp) |
( boxColor pointer.PMatrix) |
( lineColor pointer.PMatrix) |
( symbolColor pointer.PMatrix) |
( x <string>) |
( y <string>) |
( trigger <string>) |
( snapshotData <sim.data.Data>) |
( snapshotFunApp <sim.funApp.FunApp>) |
( snapshotXElement expression.IntExp) |
( snapshotYElement expression.IntExp) |
( snapshotSamples expression.IntExp))* }
sim.display.SaveDisplay ::= { (( animate <boolean>) | // Save GIFs periodically.
( filename <string>) |
( trigger <string>) |
( freq expression.IntExp) |
( maxFrames expression.IntExp) |
( display <Display>))* }
sim.errFun ::= { k NumExp } // Advantage Learning.
.AdvantageLearning
sim.errFun.Batch ::= { batchSize IntExp <sim.errFun.ErrFun> } // Call the ErrFun this many times and averages the
// errors into a single error.
sim.errFun.ErrAvg ::= { <sim.errFun.ErrFun> * } // Call all these error functions and average their
// errors.
sim.errFun.LocalLearning ::= { incremental <boolean> data <sim.data.Data> // learn a input/output mapping.
funApp <sim.funApp.FunApp> }
sim.errFun.PDFE ::= { [ c NumExp] input <sim.data.Data> target // emulate a target PDF.
<sim.data.Data> funApp <sim.funApp.FunApp> }
sim.errFun.QLearning ::= // Q Learning.
sim.errFun ::= { ( MDP <sim.mdp.MDP> | // Reinforcement Learning Experiment Wrapper.
.ReinforcementLearning funApp <sim.funApp.FunApp> dt NumExp |
gamma NumExp |
incremental <boolean> |
trajectories <boolean> exploration NumExp |
algorithm <sim.errFun.RLErrFun> |
method ( resGrad |
direct |
( residual (NumExp | adapt NumExp*))))* }
sim.errFun ::= { incremental <boolean> data <sim.data.Data> // learn a input/output mapping.
.SupervisedLearning funApp <sim.funApp.FunApp> }
sim.errFun.ValueIteration ::= // Value Iteration.
sim.funApp ::= { }
.InterferenceFunction
sim.funApp.LookupTable ::= ( { NumExp NumExp IntExp } )+ // Lookup Table.
sim.funApp.Net ::= { ( Identity | // Neural network which computes the first and second
HardlimitingSquashing | // derivitives wrt the weights and inputs.
Bipolar |
Monopolar |
ExponentialInverted |
HyperbolicTan |
Sin |
Gaussian ) ( Linear |
Quadratic1 |
Quadratic2 ) ( NumExp ) (( Identity |
HardlimitingSquashing |
Bipolar |
Monopolar |
ExponentialInverted |
HyperbolicTan |
Sin |
Gaussian ) ( IntExp ) ( Linear |
Quadratic1 |
Quadratic2 ) ( NumExp ) ) * (( Identity |
HardlimitingSquashing |
Bipolar |
Monopolar |
ExponentialInverted |
HyperbolicTan | Sin | Gaussian )
sim.funApp.Recurrent ::= // Recurrent network.
sim.funApp.SpiralFunction ::= // spiral function.
sim.funApp.ValuePolicy ::= { (( statesOnly <boolean>) | // A function that takes a state and returns the
( dt expression.NumExp) | // value of the state with the optimal action.
( gamma expression.NumExp) |
( mdp <sim.mdp.MDP>) |
( funApp <sim.funApp.FunApp>))* }
sim.gradDesc.Backprop ::= { (( learningRate expression.NumExp) | // backprop with momentum.
( momentum expression.NumExp) |
( smooth expression.NumExp) |
( tolerance expression.NumExp) |
( minInitWeight expression.NumExp) |
( maxInitWeight expression.NumExp) |
( error <sim.errFun.ErrFun>))* }
sim.gradDesc.ConjGrad ::= { (( step expression.NumExp) | // Conjugate Gradient.
( mode expression.NumExp) |
( tolerance expression.NumExp) |
( error <sim.errFun.ErrFun>) |
( minInitWeight expression.NumExp) |
( maxInitWeight expression.NumExp))* }
sim.gradDesc.IDD ::= { (( theta expression.NumExp) | // Incremental Delta Delta.
( smooth expression.NumExp) |
( tolerance expression.NumExp) |
( error <sim.errFun.ErrFun>) |
( minInitWeight expression.NumExp) |
( maxInitWeight expression.NumExp) |
( initBetas expression.NumExp) |
( maxBeta expression.NumExp) |
( seed expression.NumExp))* }
sim.mdp.GridWorld ::= { (( granularity expression.IntExp))* } // 2D Continuous Grid World.
sim.mdp.HC ::= { (( epochSize expression.IntExp))* } // Homocidal chauffeur problem, with a bike instead
// of a pedestrian.
sim.mdp.HCDemo ::= { (( epochSize expression.IntExp))* } // Homocidal chauffeur problem, with a bike instead
// of a pedestrian.
sim.mdp.Hall ::= { } // A Hall Markov chain.
sim.mdp.LQR ::= { (( discrete <boolean>) | // Linear-Quadratic Regulator.
( epochSize expression.IntExp))* }
sim.mdp.XORmdp ::= { } // XOR Markov Decision Process.
<Display> ::= ShowEdit ShowEdit |
Title Title |
Graph2D sim.display.Graph2D |
Graph3D sim.display.Graph3D |
SaveDisplay sim.display.SaveDisplay
<Project> ::= Credits Credits |
FindBNF FindBNF |
ShowThreads ShowThreads |
TestMatrix TestMatrix |
Simulator sim.Simulator
<picture.PicPipe> ::= Animation picture.Animation |
Antialias picture.Antialias |
ColorMap picture.ColorMap |
Description picture.Description |
Edges picture.Edges |
Gallery picture.Gallery |
PicPipePipeline picture.PicPipePipeline |
Region picture.Region |
RndColor picture.RndColor |
TimebombFractal picture.TimebombFractal |
ValueMap picture.ValueMap |
Fract1 picture.directFractal.Fract1 |
Maze picture.directFractal.Maze
<sim.Experiment> ::= ForExperiment sim.ForExperiment |
TDLambda sim.TDLambda |
Backprop sim.gradDesc.Backprop |
ConjGrad sim.gradDesc.ConjGrad |
IDD sim.gradDesc.IDD
<sim.data.Data> ::= Dot sim.data.Dot |
OnesRnd sim.data.OnesRnd |
RemoteTable sim.data.RemoteTable |
RndCircle sim.data.RndCircle |
RndDisk sim.data.RndDisk |
RndOnes sim.data.RndOnes |
RndUniformLine sim.data.RndUniformLine |
RndUniformSquare sim.data.RndUniformSquare |
SpiralData sim.data.SpiralData |
Table sim.data.Table |
XOR sim.data.XOR
<sim.display.Plot> ::= Picture picture.Picture |
Contour sim.display.Contour |
Grid sim.display.Grid |
PlotXY sim.display.PlotXY
<sim.errFun.ErrFun> ::= AdvantageLearning sim.errFun.AdvantageLearning |
Batch sim.errFun.Batch |
ErrAvg sim.errFun.ErrAvg |
LocalLearning sim.errFun.LocalLearning |
PDFE sim.errFun.PDFE |
QLearning sim.errFun.QLearning |
ReinforcementLearning sim.errFun.ReinforcementLearning |
SupervisedLearning sim.errFun.SupervisedLearning |
ValueIteration sim.errFun.ValueIteration
<sim.errFun.RLErrFun> ::= AdvantageLearning sim.errFun.AdvantageLearning |
QLearning sim.errFun.QLearning |
ReinforcementLearning sim.errFun.ReinforcementLearning |
ValueIteration sim.errFun.ValueIteration
<sim.funApp.FunApp> ::= InterferenceFunction sim.funApp.InterferenceFunction |
LookupTable sim.funApp.LookupTable |
Net sim.funApp.Net |
Recurrent sim.funApp.Recurrent |
SpiralFunction sim.funApp.SpiralFunction |
ValuePolicy sim.funApp.ValuePolicy
<sim.mdp.MDP> ::= GridWorld sim.mdp.GridWorld |
HC sim.mdp.HC |
HCDemo sim.mdp.HCDemo |
Hall sim.mdp.Hall |
LQR sim.mdp.LQR |
XORmdp sim.mdp.XORmdp
<string> ::= a string in single or double quotes
<integer> ::= an integer (no decimal point)
<double> ::= a floating point number with a decimal point
<boolean> ::= true | false