annotate samples/logical.tp @ 231:e48c74a7539e

Fix string parsing in grammar and add it to the primlitsym rule. Add parentheses expressions. Allow parsing from a file.
author Michael Pavone <pavone@retrodev.com>
date Thu, 02 Jan 2014 22:49:51 -0800
parents 59a94f3ad56f
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
97
59a94f3ad56f Added short-circuit && and || operators
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1 #{
59a94f3ad56f Added short-circuit && and || operators
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
2
59a94f3ad56f Added short-circuit && and || operators
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
3 foo <- {
59a94f3ad56f Added short-circuit && and || operators
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
4 print: "foo\n"
59a94f3ad56f Added short-circuit && and || operators
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
5 true
59a94f3ad56f Added short-circuit && and || operators
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
6 }
59a94f3ad56f Added short-circuit && and || operators
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
7
59a94f3ad56f Added short-circuit && and || operators
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
8 bar <- {
59a94f3ad56f Added short-circuit && and || operators
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
9 print: "bar\n"
59a94f3ad56f Added short-circuit && and || operators
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
10 false
59a94f3ad56f Added short-circuit && and || operators
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
11 }
59a94f3ad56f Added short-circuit && and || operators
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
12
59a94f3ad56f Added short-circuit && and || operators
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
13 baz <- {
59a94f3ad56f Added short-circuit && and || operators
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
14 print: "baz\n"
59a94f3ad56f Added short-circuit && and || operators
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
15 true
59a94f3ad56f Added short-circuit && and || operators
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
16 }
59a94f3ad56f Added short-circuit && and || operators
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
17
59a94f3ad56f Added short-circuit && and || operators
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
18 qux <- {
59a94f3ad56f Added short-circuit && and || operators
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
19 print: "shouldn't be printed\n"
59a94f3ad56f Added short-circuit && and || operators
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
20 true
59a94f3ad56f Added short-circuit && and || operators
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
21 }
59a94f3ad56f Added short-circuit && and || operators
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
22
59a94f3ad56f Added short-circuit && and || operators
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
23
59a94f3ad56f Added short-circuit && and || operators
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
24 main <- {
59a94f3ad56f Added short-circuit && and || operators
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
25 foo && bar || (baz || qux)
59a94f3ad56f Added short-circuit && and || operators
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
26 }
59a94f3ad56f Added short-circuit && and || operators
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
27
59a94f3ad56f Added short-circuit && and || operators
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
28 }