Split the parser from the code generator
This commit is contained in:
@ -153,12 +153,12 @@ TYPE
|
||||
PAstTypeExpression = POINTER TO AstTypeExpression;
|
||||
PPAstTypeExpression = POINTER TO PAstTypeExpression;
|
||||
|
||||
AstTypeDeclaration = RECORD
|
||||
AstTypedDeclaration = RECORD
|
||||
identifier: Identifier;
|
||||
type_expression: PAstTypeExpression
|
||||
END;
|
||||
PAstTypeDeclaration = POINTER TO AstTypeDeclaration;
|
||||
PPAstTypeDeclaration = POINTER TO PAstTypeDeclaration;
|
||||
PAstTypedDeclaration = POINTER TO AstTypedDeclaration;
|
||||
PPAstTypedDeclaration = POINTER TO PAstTypedDeclaration;
|
||||
|
||||
AstVariableDeclaration = RECORD
|
||||
variable_name: Identifier;
|
||||
@ -167,23 +167,38 @@ TYPE
|
||||
PAstVariableDeclaration = POINTER TO AstVariableDeclaration;
|
||||
PPAstVariableDeclaration = POINTER TO PAstVariableDeclaration;
|
||||
|
||||
AstProcedureDeclaration = RECORD
|
||||
name: Identifier;
|
||||
parameter_count: CARDINAL;
|
||||
parameters: PAstTypedDeclaration;
|
||||
return_type: PAstTypeExpression;
|
||||
constants: PPAstConstantDeclaration;
|
||||
variables: PPAstVariableDeclaration;
|
||||
statements: AstCompoundStatement
|
||||
END;
|
||||
PAstProcedureDeclaration = POINTER TO AstProcedureDeclaration;
|
||||
PPAstProcedureDeclaration = POINTER TO PAstProcedureDeclaration;
|
||||
|
||||
AstModule = RECORD
|
||||
main: BOOLEAN;
|
||||
imports: PPAstImportStatement;
|
||||
constants: PPAstConstantDeclaration;
|
||||
types: PPAstTypeDeclaration;
|
||||
variables: PPAstVariableDeclaration
|
||||
types: PPAstTypedDeclaration;
|
||||
variables: PPAstVariableDeclaration;
|
||||
procedures: PPAstProcedureDeclaration;
|
||||
statements: AstCompoundStatement
|
||||
END;
|
||||
PAstModule = POINTER TO AstModule;
|
||||
|
||||
PROCEDURE parse_type_expression(lexer: PLexer): PAstTypeExpression;
|
||||
PROCEDURE parse_type_part(lexer: PLexer): PPAstTypeDeclaration;
|
||||
PROCEDURE parse_type_part(lexer: PLexer): PPAstTypedDeclaration;
|
||||
PROCEDURE parse_variable_part(lexer: PLexer): PPAstVariableDeclaration;
|
||||
PROCEDURE parse_constant_part(lexer: PLexer): PPAstConstantDeclaration;
|
||||
PROCEDURE parse_import_part(lexer: PLexer): PPAstImportStatement;
|
||||
PROCEDURE parse_designator(lexer: PLexer): PAstExpression;
|
||||
PROCEDURE parse_expression(lexer: PLexer): PAstExpression;
|
||||
PROCEDURE parse_return_statement(lexer: PLexer): PAstStatement;
|
||||
PROCEDURE parse_assignment_statement(lexer: PLexer; assignee: PAstExpression): PAstStatement;
|
||||
PROCEDURE parse_call_statement(lexer: PLexer; call: PAstExpression): PAstStatement;
|
||||
PROCEDURE parse_statement_part(lexer: PLexer): AstCompoundStatement;
|
||||
PROCEDURE parse_procedure_part(lexer: PLexer): PPAstProcedureDeclaration;
|
||||
PROCEDURE parse_module(lexer: PLexer): PAstModule;
|
||||
|
||||
END Parser.
|
||||
|
Reference in New Issue
Block a user