A new language for AIML #93

Closed
opened 2025-10-14 17:34:32 -06:00 by navan · 0 comments
Owner

Originally created by @keiffster on 9/24/2019

I've been playing round with defining a new language for AIML, during a recent project which required writing a lot of new and complex AIML the use of XML started to become the inhibitor of rapid development.

This is the bare bones of the language, it shows the basics of the grammar and how simple pattern matches are made up. Ive started work on a parser which converts to AIML, along with an AIML to the new langauge ( as yet unnamed, but possible AIPL - AI Programming Langauge ) converter

The intent is to make it available in IDEs with Syntax highlighting, grammar linting etc


# This is a comment

# This is the most basic pattern, topic and that default to *
category: {
	pattern: {
		HELLO WORLD
	}
	template: {
		Hi there!
	}
}

# Specifically including topic and star
category: {
	topic: {*}
	that: {*}
	pattern: {
		HELLO WORLD
	}
	template: {
		Hi there!
	}
}

# Defining topic outside of category, will be topic scope for all categoies within {}
topic: TESTING {
	category: {
		that: {*}
		pattern: {
			HELLO WORLD
		}
		template: {
			Hi there!
		}
	}
}

# Matching a wild card directly to a variable
# !xxx -> Global Variable
# ?xxx -> Local Variable
category: { 
	pattern: {
		*!phrase
	}
	template: {
			You said !phrase
		}	
	}
}


category: { 
	pattern: {
		HELLO
	}
	template: {
		random:
			{Hello}
			{Hi}
			{Yo}
	}
}

category: { 
	pattern: {
		Who is *!name #?surname
	}
	template: {
		if:
			!name=='fred': {Hey Fred ?surname}
			!name=='mary': {Hey Mary ?surname}
		else: 
			{Don't know, run!!!}

	}
}


*Originally created by @keiffster on 9/24/2019* I've been playing round with defining a new language for AIML, during a recent project which required writing a lot of new and complex AIML the use of XML started to become the inhibitor of rapid development. This is the bare bones of the language, it shows the basics of the grammar and how simple pattern matches are made up. Ive started work on a parser which converts to AIML, along with an AIML to the new langauge ( as yet unnamed, but possible AIPL - AI Programming Langauge ) converter The intent is to make it available in IDEs with Syntax highlighting, grammar linting etc ```python # This is a comment # This is the most basic pattern, topic and that default to * category: { pattern: { HELLO WORLD } template: { Hi there! } } # Specifically including topic and star category: { topic: {*} that: {*} pattern: { HELLO WORLD } template: { Hi there! } } # Defining topic outside of category, will be topic scope for all categoies within {} topic: TESTING { category: { that: {*} pattern: { HELLO WORLD } template: { Hi there! } } } # Matching a wild card directly to a variable # !xxx -> Global Variable # ?xxx -> Local Variable category: { pattern: { *!phrase } template: { You said !phrase } } } category: { pattern: { HELLO } template: { random: {Hello} {Hi} {Yo} } } category: { pattern: { Who is *!name #?surname } template: { if: !name=='fred': {Hey Fred ?surname} !name=='mary': {Hey Mary ?surname} else: {Don't know, run!!!} } } ```
navan 2025-10-14 17:34:32 -06:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github/program-y#93
No description provided.