Skip to content

Commit

Permalink
{doc} Update docs for change in grammar (wildcards)
Browse files Browse the repository at this point in the history
[skip ci]
  • Loading branch information
asmaloney committed May 31, 2022
1 parent 24f2ea6 commit b2fd0fc
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 39 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ All notable changes to this project will be documented in this file. The format
- Added some range checks.
- Warn per-framework about any unsupported options.
- Turn on **pyactr**'s _subsymbolic_ option to be in line with **vanilla**
- Replaced "anonymous variable" (`?`) with a wildcard character (`*`). ([#123](https://github.com/asmaloney/gactar/pull/123))

## [0.5.0](https://github.com/asmaloney/gactar/releases/tag/v0.5.0) - 2022-05-26

Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,10 @@ There are more details on each step below, but here's the short version:

```
match {
goal [isMember: ?obj ? nil]
goal [isMember: ?obj * nil]
}
do {
recall [property: ?ojb category ?]
recall [property: ?ojb category *]
}
```

Expand All @@ -105,7 +105,7 @@ There are more details on each step below, but here's the short version:

```
match {
goal [isMember: ?obj ? nil]
goal [isMember: ?obj * nil]
}
do {
set goal.jugdment to 'pending'
Expand Down Expand Up @@ -555,7 +555,7 @@ start {
}
// Steps to execute
do {
recall [count: ?start ?]
recall [count: ?start *]
set goal to [countFrom: ?start ?end counting]
}
}
Expand All @@ -567,7 +567,7 @@ increment {
}
do {
print ?x
recall [count: ?next ?]
recall [count: ?next *]
set goal.start to ?next
}
}
Expand Down
91 changes: 57 additions & 34 deletions doc/amod EBNF.txt
Original file line number Diff line number Diff line change
@@ -1,60 +1,83 @@
This was generated by converting the output of "./gactar -ebnf" using https://bottlecaps.de/convert/

That site will also generate nice railroad diagrams for the grammar.
---

AmodFile ::= '==model==' ModelSection '==config==' ConfigSection? '==init==' InitSection? '==productions==' ProductionSection?

ModelSection ::= 'name' ':' ( string | ident ) ( 'description' ':' string )? ( 'authors' '{' string* '}' )? ( 'examples' '{' Pattern* '}' )?
ModelSection
::= 'name' ':' ( string | ident ) ( 'description' ':' string )? ( 'authors' '{' string* '}' )? ( 'examples' '{' Pattern* '}' )?

Pattern ::= '[' ident ':' PatternSlot+ ']'
Pattern ::= '[' ident ':' PatternSlot+ ']'

PatternSlot ::= patternspace? PatternSlotItem+ patternspace?
PatternSlot
::= patternspace? PatternSlotItem+ patternspace?

PatternSlotItem ::= '!'? ( 'nil' | ident | number | patternvar )
PatternSlotItem
::= '!'? ( 'nil' | ident | number | patternvar )
| patternwildcard

ConfigSection ::= ( 'gactar' '{' Field* '}' )? ( 'modules' '{' Module* '}' )? ( 'chunks' '{' ChunkDecl* '}' )?
ConfigSection
::= ( 'gactar' '{' Field* '}' )? ( 'modules' '{' Module* '}' )? ( 'chunks' '{' ChunkDecl* '}' )?

Field ::= ident ':' FieldValue ','?
Field ::= ident ':' FieldValue ','?

FieldValue ::= ident
| string
| number
FieldValue
::= ident
| string
| number

Module ::= ident '{' Field* '}'
Module ::= ident '{' Field* '}'

ChunkDecl ::= '[' ident ':' ChunkSlot+ ']'
ChunkDecl
::= '[' ident ':' ChunkSlot+ ']'

ChunkSlot ::= patternspace? ident patternspace?
ChunkSlot
::= patternspace? ident patternspace?

InitSection ::= Initialization*
InitSection
::= Initialization*

Initialization ::= ident ( Pattern | '{' Pattern+ '}' )
Initialization
::= ident ( '{' Pattern+ '}' | Pattern )

ProductionSection ::= Production+
ProductionSection
::= Production+

Production ::= ident '{' ( 'description' ':' string )? Match Do '}'
Production
::= ident '{' ( 'description' ':' string )? Match Do '}'

Match ::= 'match' '{' MatchItem+ '}'
Match ::= 'match' '{' MatchItem+ '}'

MatchItem ::= ident Pattern
MatchItem
::= ident Pattern

Do ::= 'do' '{' Statement+ '}'
Do ::= 'do' '{' Statement+ '}'

Statement ::= ClearStatement
| PrintStatement
| RecallStatement
| SetStatement
Statement
::= ClearStatement
| PrintStatement
| RecallStatement
| SetStatement

ClearStatement ::= 'clear' ( ident ','? )+
ClearStatement
::= 'clear' ( ident ','? )+

PrintStatement ::= 'print' ( Arg ','? )*
PrintStatement
::= 'print' ( Arg ','? )*

Arg ::= patternvar
| ident
| string
| number
Arg ::= patternvar
| ident
| string
| number

RecallStatement ::= 'recall' Pattern
RecallStatement
::= 'recall' Pattern

SetStatement ::= 'set' ident ( '.' ident )? 'to' ( SetValue | Pattern )
SetStatement
::= 'set' ident ( '.' ident )? 'to' ( SetValue | Pattern )

SetValue ::= 'nil'
| patternvar
| string
| number
| patternvar
| string
| number

0 comments on commit b2fd0fc

Please sign in to comment.