Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

Edited

package main

import "fmt"

func  Stmt() { 
    fmt.Printf("%d",2)
    switch lookahead {
      case "expr":
        match("expr")
        match(";")
      case "if":
        match("if")
        match("(")
        match("expr")
        match(")")
        Stmt()
      case "for":
        match("for")
        match("(")
        optexpr()
        match(";")
        optexpr()
        match(";")
        optexpr()
        match(")")
        expr()
      case "other":
        match("other")
      default:
        report("syntax error")
    }
}
func optexpr(){
    if lookahead == expr{
      match(expr)
} 
func (t terminal)match(){
    if lookahead == t {
        lookahead=nextTerminal
    }else{
        report("syntax error")
          }
}
func main() {
    
    
      
      
    
    
    
    
       
}

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.