Create a Ballot

Creating a ballot using the BLT grammar. The ballot consists of a header, a body, and a set of ballot parameters. The header is simply:

(unvoted-ballot 'BALLOT_NAME

where BALLOT_NAME is the name of the ballot (must be under 50 characters).

The body of the ballot is a series of blocks, paragraphs, and queries. Blocks are simply containers for holding paragraphs, queries, and other blocks. Paragraphs contain text that is to be displayed to the voter. Queries indicate that information should be collected from the voter. A typical ballot question will consist of a block that contains a paragraph which asks a question, a block that contains several paragraphs which represent the possible answer choices, and a query. All blocks, paragraphs, and queries are labeled.

Queries contain parameters that indicate the type of response expected from the voter. The method parameter may be "select" indicating that the voter must select from a group of answer choices, "alpharange" indicating that the voter may enter a letter within a given range, and "intrange" indicating that the voter may enter an integer within a given range. If the "select" method is used, the paramater "param1" should be an integer indicating how many choices the voter should select, and "param2" should be the label of the block that contains the choices. If alpharange or intrange are selected, the param1 and param2 paramaters should indicate the beginning and end of the range. (Note, Sensus does not check for valid responses when polling the voter.)

Blocks have parameters too. The order parameter indicates that display should be "verbatim" or "random." The display parameter indicates that the contents of the block should be "lettered," "numbered," or "plain."

After the body comes the ballot parameters. These are the validator-key, tallier-key, validator-address, and tallir-address.

The Grammar

The grammar for BLT appears below:

<unvoted-ballot> -> (unvoted-ballot <label> 
                    ( <contents>* ) <ballot-param>* )

<block> -> (if <condition> (block <label> 
                 ( <contents>* ) <block-param>* ))

<contents> -> <block> | <paragraph> | <query>

<paragraph> -> (paragraph <label> "<character>*")

<label> -> '<up to 49 letters, digits, dashes, and 
             underscores, beginning with a letter -- 
             case sensitive>

<query> -> (query '<label> <query-param>*)

<ballot-param> -> :validator-key <key> | 
                  :tallier-key <key> |
                  :validator-address <address> | 
                  :tallier-address <address>

<block-param> -> :order <order> | :display <display>

<query-param> -> :method <method> | :param1 <param> | 
                :param2 <param>

<condition> -> t | (NOT <expression>) |
                (<operator> <expression> <expression>)

<expression> -> <number> | <label> | <condition>

<operator> -> AND | OR | = | <= | >= | + | - | * | /

<param> -> <int> | <character>

<method> -> select | alpharange | intrange | freetext

all other non-terminals are strings of characters

An example

BLT is somewhat complicated to understand, so here is an example:

(unvoted-ballot 'Movie-Poll (

  (if t (block 'MainBlock (
    (paragraph 'Title "CCRC Movie Poll")
    (paragraph 'Info "The CCRC social planners would like to organize
a movie outing.  Please help us by answering the following questions.")

        (paragraph 'Q1 "Which type of movie do you prefer?")
        (if t (block 'Q1Choices (
        (paragraph 'TH "Horror")
        (paragraph 'TD "Drama")
        (paragraph 'TA "Action")
        (paragraph 'TC "Comedy")) :order random :display lettered))
        (query 'Q1Response :method select :param1 1 :param2 Q1Choices)

        (paragraph 'Q2 "Which movie theater do you prefer?")
        (if t (block 'Q2Choices (
        (paragraph 'PT "Tivoli")
        (paragraph 'PG "Galleria")
        (paragraph 'PE "Esquire")
        (paragraph 'PH "High Point")) :order random :display lettered))
        (query 'Q2Response :method select :param1 1 :param2 Q2Choices)

        (paragraph 'Q3 "When do you prefer to go to the movies?")
        (if t (block 'Q3Choices (
        (paragraph 'WA "Late afternoon")
        (paragraph 'WE "Evening")
        (paragraph 'WN "Late night")) :order random :display lettered))
        (query 'Q3Response :method select :param1 1 :param2 Q3Choices)

        (paragraph 'Q4 "How many movies do you usually see each month?")
        (query 'Q4Response :method intrange :param1 0 :param2 50)
 ) :order verbatim :display plain )))

 :validator-key Public Key, 508 bits:

  modulus: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 00 00 00 00 00 00 00 00 00 00 00 00 00 00 09 c1 51 d5 74 2f 23 97 aa 82 77 25 0
e c6 2a 90 04 65 bf cd 10 8e e1 4c f1 e2 9b bd 6b 4b 78 44 1a ac 6a 64 81 7a 48
42 5f d7 88 0c 5d 50 83 65 8b cb 1e c5 a1 78 04 43 a0 1c ed 35 63 9e 56 ab
  exponent: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0
0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 01
  :tallier-key Public Key, 508 bits:
  modulus: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0c 2f ff 47 28 5e b5 6f 73 d5 3f eb 1
6 76 b3 5a 36 1a 43 c2 ef 9e 31 ae 0d c3 ca 50 e7 0b bf 2b ad 2a b5 ac d2 ed 40
df 3e 06 34 e4 83 1a 09 b3 9a fa 74 80 87 37 2b 7e d8 d0 f6 ab 77 53 9a 39
  exponent: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0
0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 01
  :validator-address "http://www.ccrc.wustl.edu/bin/sensus/validate"
  :tallier-address "http://www.ccrc.wustl.edu/bin/sensus/tally"
)