infix2evm
v1.0.0
Published
Convierte de lenguaje infijo a evm
Downloads
1
Readme
NearleyJs de infijo a EVM
Author: Adrián Epifanio Rodríguez Hernández
Gramática empleada:
S -> InitialDo _
InitialDo -> DO StList END
Function -> FUN LP NameList RP Statement END
FunctionCall -> name LP FunctionCallList RP
NameList -> name
| NameList COMMA name
StList -> Statement
| StList SEMICOLON Statement
FunctionCallList -> ListElement
| FunctionCallList COMMA ListElement
ListElement -> name
| number
| string
| FunctionCall
| PositionArray
Statement -> null
| Function
| FunctionCall
| InitialDo
| IF LP ComparisonExpression RP Statement ELSE Statement END
| WHILE LP ComparisonExpression RP Statement END
| LET name ASSIGNMENT DataType
| name ASSIGNMENT DataType
| PositionArray
| name LBRACKET UnaryExpression RBRACKET ASSIGNMENT DataType
DataType -> Function
| AdditiveExpression
| string
| array
| PositionArray
| FunctionCall
ComparisonExpression -> AdditiveExpression
| ComparisonExpression ComparisonOperator AdditiveExpression
ComparisonOperator -> _ ">"
| _ "<"
| _ "=="
AdditiveExpression -> MultiplicativeExpression
| AdditiveExpression PM MultiplicativeExpression
PM -> _ "+"
| _ "-"
MultiplicativeExpression -> UnaryExpression
| MultiplicativeExpression MDM UnaryExpression
MDM -> _ "*"
| _ "/"
UnaryExpression -> number
| name
| string
array -> LBRACKET ElementArray RBRACKET
ElementArray -> null
| DataType
| ElementArray COMMA DataType
PositionArray -> name LBRACKET UnaryExpression RBRACKET
# Lexical part
name -> _ /[a-z_][a-z_0-9]*/
string -> _ /(?:[^\n\\"]|\\["\\ntbfr])*/
number -> _ /[0-9]+(?:\.[0-9]+)?/
LP -> _ "("
RP -> _ ")"
LBRACKET -> _ "["
RBRACKET -> _ "]"
COMMA -> _ ","
SEMICOLON -> _ ";"
DO -> _ "do"
IF -> _ "if"
ELSE -> _ "else"
WHILE -> _ "while"
FUN -> _ "function"
END -> _ "end"
LET -> _ "let"
ASSIGNMENT -> _ "="
_ -> /[\s]:*/