-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsyntax.md
More file actions
34 lines (28 loc) · 1.19 KB
/
syntax.md
File metadata and controls
34 lines (28 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
```bnf
;; a top-level finite-choice logic program consists of
;; facts and rules to make deductions
<logic> ::= (logic <decl> ...)
| (logic #:import (<imp> ...) <decl> ...)
;; an import, which might be named from a Racket expression
<imp> ::= x:racket-var
| [x:id e:racket-expr]
;; declarations are facts (conclusions) or rules
<decl> ::= <conclusion> ; fact
| (<conclusion> :- <premise> ...+) ; rule
| (decls <decl> ...) ; nested (for macros)
;; either a relational proposition (attribute) or a functional proposition
;; while conclusions can have variables, they must be bound by premises
<conclusion> ::= <attr>
| (<attr> is {<logic-term> ...+})
;; a premise to a rule, which will imply the conclusion if
;; satisfied, and may be either relational or functional
<premise> ::= <attr>
| (<attr> is <logic-term>)
;; a proposition on zero or more terms, which should
;; always be used with a consistent amount of terms
<attr> ::= (<ID> <logic-term> ...)
;; basic data in the language, either primitive data or
;; a constructor/proposition applied to other data
<logic-term> ::= <ID>
| <DATUM>
```