Skip to content

Commit 204b7e5

Browse files
committed
Minor additions to propositional parsing
1 parent 633c15c commit 204b7e5

File tree

3 files changed

+78
-5
lines changed

3 files changed

+78
-5
lines changed

aima-csharp/aima-csharp.csproj

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -191,11 +191,6 @@
191191
<Compile Include="logic\fol\Unifier.cs" />
192192
<Compile Include="logic\fol\VariableCollector.cs" />
193193
<Compile Include="logic\propositional\agent\KBAgent.cs" />
194-
<Compile Include="logic\propositional\kb\data\Clause.cs" />
195-
<Compile Include="logic\propositional\kb\data\ConjunctionOfClauses.cs" />
196-
<Compile Include="logic\propositional\kb\data\Literal.cs" />
197-
<Compile Include="logic\propositional\kb\data\Model.cs" />
198-
<Compile Include="logic\propositional\kb\KnowledgeBase.cs" />
199194
<Compile Include="obj\Debug\TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs" />
200195
<Compile Include="obj\Debug\TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs" />
201196
<Compile Include="obj\Debug\TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs" />
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using aima.core.logic.propositional.parsing.ast;
4+
5+
namespace aima.core.logic.propositional.parsing
6+
{
7+
/**
8+
* <b>Propositional Logic Visitor:</b> A <a
9+
* href="http://en.wikipedia.org/wiki/Visitor_pattern">Visitor Pattern/</a> for
10+
* traversing the abstract syntax tree structural representation of
11+
* propositional logic used in this library. The key difference between the
12+
* default Visitor pattern and the code here, is that in the former the visit()
13+
* methods have a void visit(ConcreteNode) signature while the visitors used
14+
* here have a Object visit(ConcreteNode, Object arg) signature. This simplifies
15+
* testing and allows some recursive code that is hard with the former .
16+
*
17+
* @author Ravi Mohan
18+
* @author Ciaran O'Reilly
19+
*
20+
* @param <A>
21+
* the argument type to be passed to the visitor methods.
22+
* @param <R>
23+
* the return type to be returned from the visitor methods.
24+
*/
25+
public interface PLVisitor<A, R>
26+
{
27+
/**
28+
* Visit a proposition symbol (e.g A).
29+
*
30+
* @param sentence
31+
* a Sentence that is a propositional symbol.
32+
* @param arg
33+
* optional argument to be used by the visitor.
34+
* @return optional return value to be used by the visitor.
35+
*/
36+
R visitPropositionSymbol(PropositionSymbol sentence, A arg);
37+
38+
/**
39+
* Visit a unary complex sentence (e.g. ~A).
40+
*
41+
* @param sentence
42+
* a Sentence that is a unary complex sentence.
43+
* @param arg
44+
* optional argument to be used by the visitor.
45+
* @return optional return value to be used by the visitor.
46+
*/
47+
R visitUnarySentence(ComplexSentence sentence, A arg);
48+
49+
/**
50+
* Visit a binary complex sentence (e.g. A & B).
51+
*
52+
* @param sentence
53+
* a Sentence that is a binary complex sentence.
54+
* @param arg
55+
* optional argument to be used by the visitor.
56+
* @return optional return value to be used by the visitor.
57+
*/
58+
R visitBinarySentence(ComplexSentence sentence, A arg);
59+
}
60+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
using System;
2+
3+
namespace aima.core.logic.propositional.parsing.ast
4+
{
5+
/**
6+
* Artificial Intelligence A Modern Approach (3rd Edition): page 244.<br>
7+
* <br>
8+
* The <b>atomic sentences</b> consist of a single proposition symbol.
9+
*
10+
* @author Ravi Mohan
11+
* @author Ciaran O'Reilly
12+
*
13+
*/
14+
public abstract class AtomicSentence : Sentence
15+
{
16+
17+
}
18+
}

0 commit comments

Comments
 (0)