/* Analyse syntaxique LL(1) par descente recursive déterministe */ public class AnalyseLL { // Analyseur et sortie en erreur de syntaxe static public void main(String[] args) { lireAxiome(); System.out.println(" Syntax OK"); } static void erreur() { throw new java.lang.RuntimeException("Syntax Error"); } // Tokens enum Tok {EOF, IDENT, INT, PLUS, MOINS, MULT, DIV, LPAR, RPAR} // Lexer static Tok input[]= {Tok.INT , Tok.MOINS, Tok.IDENT, Tok.MULT, Tok.INT, Tok.MOINS, Tok.INT, Tok.EOF}; static int index=0; static void lireTok(Tok t) { if ( input[index++] != t ) erreur(); } static Tok aheadTok() { return input[index]; } // Parser // ... Ecrire recursivement les méthodes : // lireAxiome(), lireExp(), lireTerme(), lireSuiteTerme(), // lireSuiteFacteur(), lireFacteur(). }