PleaseLangCompiler

The file with the code to interpret the Please lang
Since:
  • 8/04/2021
Author:

Classes

Lexer

Members

inner, constant WHITE

The defition of whitespace in the Please language

Methods

inner compile(origin, destination)

A function that compiles a Please file
Parameters:
Name Type Description
origin string The name of the origin file
destination string The name of the destination file
Throws:
Will throw if there are errors in the program or if the files can't be opened

inner parse(program) → {Object}

A function that parses a Please program
Parameters:
Name Type Description
program string The string with the unparsed program
Throws:
Will throw if there are errors in the program
Returns:
Object - The AST of the program

inner parseCall(operator, lexer) → {Object}

A function that parses a call
Parameters:
Name Type Description
operator Object The already parsed operator of the operator
lexer Lexer An instance of the Lexer class properly initialized
Throws:
Will throw if there are syntactical errors
Returns:
Object - The JSON AST of the call

inner parseExpression(lexer) → {Object}

A function that parses an expression
Parameters:
Name Type Description
lexer Lexer An instance of the Lexer class initialized with the source of the program
Throws:
Will throw if there are syntactical errors
Returns:
Object - The JSON AST of the expression

inner parseFromFile(fileName) → {Object}

A function that reads a file and parses its contents
Parameters:
Name Type Description
fileName string The name of the file
Throws:
Will throw if there are errors in the program or if the file can't be opened
Returns:
Object - The JSON AST of the program