TAILIEUCHUNG - compilers principles techniques and tools phần 4

như nhà nước 10 trong hình. . Có lẽ nhà nước được nhập vào sau khi nhìn thấy thứ chữ cái, mà là một tiền tố của từ khóa sau đó cũng như có khả năng là tiền tố của một số lexeme cho một định danh. E ký tự nhập vào, chúng tôi phải đi từ nhà nước của một nhà nước đặc biệt nhớ lại chúng tôi | Simpo PDF Merge and Split Unregistered Version - http head body i I body 2 Ị body n semantic action 1 semantic action 2 semantic action n In a Yacc production unquoted strings of letters and digits not declared to be tokens are taken to be nonterminals. A quoted single charâcter . c is taken to be the terminal symbol c as wéll as the integer code for the token represented by that character . Lex would return the character code for c to the parser as an integer . Alternative bodies can be separated by a vertical bar and a semicolon follows each head with its alternatives and their semantic actions. The first head is taken to be the start symbol. A Yacc semantic action is a sequence of c statements. In a semantic action the symbol refers to the attribute value associated with the nonterminal of the head while z refers to the value associated with the zth grammar symbol terminal or nonterminal of the body. The semantic action is performed whenever we reduce by the associated production so normally the semantic action computes a value for in terms of the i s. In the Yacồ specification we have written the two E-productions E-ÌÉ T I T and their associated semantic actions as expr expr term 1 3 I term Note that the nonterminal term in the first production is the third grammar symbol of the body while is the second. The semantic action associated with the first production adds the value of the expr and the term of the body and assigns the result as the value for the nonterminal expr of the head. We have omitted the semantic action for the second production altogether since copying the value is the default action for productions with a single grammar symbol in the body. In general 1 is the default semantic action. Notice that we have added a new starting production line expr n printf n 1 to the Yacc specification. This production says that an input to the desk calculator ỈS to be an expression followed by a newline character. The semantic action .

TỪ KHÓA LIÊN QUAN
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.