Here is the BNF file
"Name" = 'SPL'
"Version" = '2009'
"Author" = ''Mir Sajal'
"About" = 'Simple SPL'
"Case Sensitive" = False
"Start Symbol" =
<Character>::= {letter}
<Digit>::= {digit}
<CharacterOrDigit>::= {alphanumeric}
NewLine ::= {CR}{LF}|{CR}
<Identifier>::= <Character><CharacterOrDigit>*
<Number>::= <Digit>*|<Digit>+"."<Digit>+
<Negative;>::= "-"
<NumberConstant>::= <Negative><Number>|<Number>
<CharacterConstant>::= "'"<Character>"'"
<Constant>::= <NumberConstant>|<CharacterConstant>
<Value<::= <Identifier>|<Constant>|"("<Expression>")"
<Term>::=^lt;Value>|<Value>>"*"<Value>+|<Value>"/"<Value>+
<Expression>::= <Term>|<Term>"+"<Term>+|<Term>"-"<Term>+
<Comparator>::= "=" | "><" | "<" | ">" | "<=" | ">="
<AndOr>::= AND | OR
<Check>::= [<Not>]<Expression><Comparator><Expression>
<Conditional>::= <Check>|<Check><AndOr><Check>+
<Program> ::= <Identifier>";"<Block>"ENDP"<Identifier>"."
<Block>::= [DECLARATIONS<DeclarationBlock>]CODE<StatementList>
<IdentifierList>::= <Identifier>|<Identifier>","<Identifier>+
<DeclarationBlock>::= <IdentifierList> OF TYPE<Type>";"
<Type>::= CHARACTER | INTEGER | REAL
<StatementList>::= <Statement>|<Statement>";"<Statement>+";"
<Statement>::= <Assignment> | <If> | <Do> | <While> | <Write> | <Read>
<Assignment>::= <Expression> "->" <Identifier>
<If>::= IF <Conditional> THEN <StatementList> ["ELSE" <StatementList>] ENDIF
<Do>::= DO<StatementList>WHILE<Conditional>ENDDO
<While>::= WHILE<Conditional>DO<StatementList>ENDWHILE
<For>::= FOR<Identifier>IS<Expression>BY<Expression>TO<Expression>DO<StatementList>ENDFOR
<Write>::= WRITE<OutputList> | Newline
<Read>::= READ<Identifier>
<OutputList>::= <Value> |<Value>","<Value>+
2 comments:
Good article I think that the project on compiler cosntruction seems pretty interesting.
Thanks,
Portable Storage,
http://moveablecubicle.com/quote.aspx
Thanks
Post a Comment