Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

draft: specify numerical functions #76

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions specgen/spec/sec-gates.s
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ DEFGATE TT p q AS SEQUENCE:
T p
T q
}
@p{The standard gate `CSWAP` (Toffoli) could be defined with the following definition:}
@p{The standard gate @c{CSWAP} (Toffoli) could be defined with the following definition:}
@clist{
DEFGATE TOFFOLI p q r AS SEQUENCE:
H r
Expand All @@ -343,7 +343,7 @@ DEFGATE TOFFOLI p q r AS SEQUENCE:
CNOT q r
DAGGER T r
CNOT p r
#Note the use of TT here
# Note the use of TT here
TT q r
CNOT p q
H r
Expand All @@ -353,8 +353,7 @@ DEFGATE TOFFOLI p q r AS SEQUENCE:
}
@p{An arbitrary Euler rotation could be expressed as:}

@clist{

@clist{
DEFGATE EULER(%alpha, %beta, %gamma) p AS SEQUENCE:
RY(%alpha) p
RZ(%beta) p
Expand Down
24 changes: 23 additions & 1 deletion specgen/spec/sec-structure.s
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ associativity directions.

@syntax[:name "Term"]{
- @ms{Expression}
@alt @ms{Identifier} ( @ms{Expression} )
@alt @ms{Function Expression}
@alt ( @ms{Expression} )
@alt @ms{Complex}
@alt @ms{Parameter}
Expand All @@ -230,6 +230,28 @@ enough to warrant their own production.}
}
}

@p{This allows us to specify the @ms{Function Expression}.}

@syntax[:name "Function Expression"]{
@ms{Function Name} ( @ms{Expression List} )
}


@subsubsection[:title "Functions in Arithmetic Expressions"]

@p{The following functions are allowed to be used in function
expressions.}

@syntax[:name "Function Name"]{
@ms{Trigonometric Function Name}
@alt @ms{Inverse Trigonometric Function Name}
@alt @ms{Algebraic Function Name}
SIN | COS | TAN | ASIN | ACOS | ATAN | SQRT | ATAN2
}

@p{All functions listed take on their usual definitions over the
complex numbers.}

@subsection[:title "Main Program Elements"]

@p{A Quil program consists of declarations, directives, and
Expand Down