rslc compiler.
To understand the syntax first, read RSL at a glance.
The rating plan
This example uses these rules:- Multiply Coverage A, in thousands of dollars, by a rate for each peril.
- Choose rates from the dwelling’s protection class.
- Add 1.5% of each scheduled item’s value.
- Add a $35 policy fee.
- Round the total premium to whole dollars, half up.
Create the files
Create a folder for the rater and its rate table:Rating algorithm
Save the following source asrater.rsl in the dwelling/ folder.
rater.rsl
rater.rsl
dwelling/rater.rsl
premium outcome.
base_rate gives the table lookup a name, so peril_premium is arithmetic over named values.
artifact(...) identifies a source document in Effective by its artifact ID. This tutorial uses a placeholder ID for its synthetic manual.
Citations such as manual:p3 refer to pages in that document.
Rate table
Save this table astables/BaseRate.csv in the same folder:
dwelling/tables/BaseRate.csv
Check and package the rater
Run the compiler check:Rate a policy
From the samedwelling/ folder, load the bundle and supply the policy facts:
Inspect the calculations
Inspect the calculations
Rater.build compiles it straight from the source file and skips the export:
Rater.build takes the .rsl file, or the folder that holds it. A source that fails to compile raises BundleError, and rslc check prints each message.
The bundle from rslc export, loaded with Rater.load, is the packaged route: one file to keep and share.
Test an input rule
Submit a protection class outside the accepted range:reason holds the input’s path, then the message.
For a rule on a record, reason holds the record’s path, then the message, and the message alone for the root record Policy.
Refusals explains how to inspect the rule’s source citation.