package Compiler;

import java.util.List;

abstract class Statement {

    static class ExpressionStatement extends Statement{
        ExpressionStatement(Expression expr){
            this.expr = expr;
        }


        final Expression expr;

        @Override
        public String getStatmentType() {
            return "exprStmt";
        }
    }

    static class BlockStatement extends Statement{
        BlockStatement(List<Statement> statements){
            this.statements=statements;
        }

        final List<Statement> statements;

        @Override
        public String getStatmentType() {
            return "block";
        }
        
    }

    static class IfStatement extends Statement{
        IfStatement(Expression condition, Statement ifBlock,Statement elseBlock){
            this.condition=condition;
            this.ifBlock=ifBlock;
            this.elseBlock=elseBlock;
        }

        final Expression condition;
        final Statement ifBlock;
        final Statement elseBlock;

        @Override
        public String getStatmentType() {
            return "ifStmt";
        }
    }

    static class DoStatement extends Statement{
        DoStatement(Expression variable, Expression start,Expression stop,Expression step,Statement codeBlock){
            this.variable=variable;
            this.start=start;
            this.stop=stop;
            this.step=step;
            this.codeBlock=codeBlock;

        }

        final Expression variable;
        final Expression start;
        final Expression stop;
        final Expression step;
        final Statement codeBlock;

        @Override
        public String getStatmentType() {
            return "doStmt";
        }
    }

    static class DoWhileStatement extends Statement{
        DoWhileStatement(Expression condition,Statement codeBlock){
            this.condition=condition;
            this.codeBlock=codeBlock;

        }

        final Expression condition;
        final Statement codeBlock;

        @Override
        public String getStatmentType() {
            return "dowhileStmt";
        }
    }


    static class VariableDeclaration extends Statement{
        VariableDeclaration(Token name,String type){
            this.name=name;
            this.type=type;
        }


        final Token name;
        final String type;

        @Override
        public String getStatmentType() {
            return "varDec";
        }

    }

    static class StringDeclaration extends Statement{
        StringDeclaration(Token name,Expression length){
            this.name=name;
            this.length=length;
        }


        final Token name;
        final Expression length;

        @Override
        public String getStatmentType() {
            return "stringDec";
        }

    }

    static class ArrayDeclaration extends Statement{
        ArrayDeclaration(Token name,String type,List<Expression> dimensions){
            this.name=name;
            this.dimensions=dimensions;
            this.type=type;
        }

        final String type;
        final Token name;
        final List<Expression> dimensions;

        @Override
        public String getStatmentType() {
            return "arrayDec";
        }

    }

    static class PrintStatement extends Statement{
        PrintStatement(List<Expression> exprList){
            this.exprList=exprList;
        }
        final List<Expression> exprList;

        @Override
        public String getStatmentType() {
            return "print";
        }
    }


    public abstract String getStatmentType();
}