<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
	<xs:annotation>
		<xs:documentation> This schema implements the specifications of the AML 2.0 draft, section 2.1
			to 2.3 Rather than use the usual verbose approach where one would use tags to define
			expressions in a tree like fashion (see old lattice proposal page 27 for an example or take a look
			at the mathML specification ) we implemented a scheme allowing for the more natural syntax
			where one writes the formula directly. This schema will validate the formulas, thus allowing
			for a check before sending the document to an optics code. </xs:documentation>
	</xs:annotation>
	<xs:simpleType name="variabletag">
		<xs:restriction base="xs:token">
			<xs:pattern value="$[A-Za-z_0-9]([A-Za-z_0-9])*"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="optag">
		<xs:restriction base="xs:token">
			<xs:pattern value="-|\+|\*|/|\(|=|\)"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="fcts">
		<xs:restriction base="xs:token">
			<xs:pattern
				value="sin\(|cos\(|tan\(|asin\(|acos\(|atan\(|abs\(|ran\(|ran_gauss\(|sqrt\(|log\(|exp\(|"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="exprtype">
		<xs:union>
			<xs:simpleType>
				<xs:restriction base="variabletag"/>
			</xs:simpleType>
			<xs:simpleType>
				<xs:restriction base="optag"/>
			</xs:simpleType>
			<xs:simpleType>
				<xs:restriction base="fcts"/>
			</xs:simpleType>
			<xs:simpleType>
				<xs:restriction base="xs:double"/>
			</xs:simpleType>
		</xs:union>
	</xs:simpleType>

	<xs:simpleType name="arglist">
		<xs:list itemType="exprtype"/>
	</xs:simpleType>
	<xs:element name="constant">
		<xs:complexType mixed="true">
			<xs:simpleContent>
				<xs:extension base="xs:string">
					<xs:attribute name="name" type="xs:string" use="required"/>
				</xs:extension>
			</xs:simpleContent>
		</xs:complexType>
	</xs:element>
</xs:schema>
