I plan to translate NL to Synth (a programming language I developed for AI purposes - some sort of
language enhanced with EventActions). When it is translated by universal parser, the rest is easy, it is just about running queries and transforming expressions by rules (deduction - like transforming math expressions).
Sum {
Add (Left -> @Sum, In -> "+", Right -> @Fact) -> @Add.Left + @Add.Right;
Sub (Left -> @Sum, In -> "-", Right -> @Fact) -> @Sub.Left - @Sub.Right;
Fact {
Mul (Left -> @Fact, In -> "*", Right -> @Exp) -> @Mul.Left * @Mul.Right;
Div (Left -> @Fact, In -> "/", Right -> @Exp) -> @Div.Left / @Div.Right;
Exp {
@Num;
@Var;
Braces(Left -> "(", In -> @Sum, Right -> ")") -> @Braces.In
}
}
}
From this definition it is possible to parse *and* calculate simple math expressions.
Rules for transforming can be made in somewhat similar way like these logic rules:
@And (
Left -> @Boolean,
Right -> @Boolean
) -> @And (
Left -> @Super.Right,
Right -> @Super.Left
);
@Not (
Param -> @And (
Left -> @Boolean,
Right -> @Boolean
)
) -> @Or (
Left -> @Not (
Param -> @Super.Param.Left
),
Right -> @Not (
Param -> @Super.Param.Right
)
);
Deduction is about transforming rules and induction is more complicated - it requires semantic tables.