procedure build_sdlsemdef message(""); message("Creating SDLSEMDEF.SDL ..."); message(""); set (screen_update,off); saved_pos := mark(none); temp_buf := create_buffer("temp"); set (output_file,temp_buf,"lib$:sdlsemdef.sdl"); position(temp_buf); read_file("src$:copyright.txt"); position(saved_pos); cross_ref := search("Cross Reference",FORWARD,EXACT); position(cross_ref); non_term := search("Non Terminals",FORWARD,EXACT); position(non_term); end_mark := mark(none); position(cross_ref); name_patt := span("abcdefghijklmnopqrstuvwxyz_$"); value_patt := span("0123456789"); loop move_vertical(1); coma := search(",",FORWARD,EXACT); position(coma); cur_mark := mark(none); exitif cur_mark >= end_mark; name_range := search(name_patt,FORWARD,NO_EXACT); value_range := search(value_patt,FORWARD,EXACT); position(temp_buf); copy_text("CONSTANT "); copy_text(name_range); copy_text(" EQUALS "); copy_text(value_range); copy_text(";"); eol := search(line_end,FORWARD,EXACT); position(eol); split_line; position(coma); endloop; ! ! position(temp_buf); split_line; split_line; copy_text("{ S E M A N T I C A C T I O N N U M B E R S"); eol := search(line_end,FORWARD,EXACT); position(eol); split_line; split_line; position(non_term); action := search("Action",FORWARD,EXACT); position(action); Lookahd := search("Lookahead",FORWARD,EXACT); position(lookahd); end_mark := mark(none); position(action); init_range := search("INITIALIZE",FORWARD,EXACT); position(init_range); init_val_rng := search(value_patt,FORWARD,EXACT); val_str := substr(init_val_rng,1,length(init_val_rng)); init_val := int(val_str); position(action); move_horizontal(1); action_name_patt := spanl("ABCDEFGHIJKLMNOPQRSTUVWXYZ_$"); loop name_range := search(action_name_patt,FORWARD,EXACT); position(name_range); cur_mark := mark(none); exitif cur_mark >= end_mark; value_range := search(value_patt,FORWARD,EXACT); val_str := substr(value_range,1,length(value_range)); val := ( int(val_str) - init_val ) + 1; position(temp_buf); copy_text("CONSTANT "); copy_text(name_range); copy_text(" EQUALS "); copy_text( str(val) ); copy_text(";"); eol := search(line_end,FORWARD,EXACT); position(eol); split_line; position(value_range); endloop; position(temp_buf); copy_text("END_MODULE;"); position(saved_pos); set (screen_update,on); message("SDLSEMDEF.SDL has been created"); endprocedure; set (SUCCESS,OFF); input_file := get_info(command_line,'file_name'); main_buffer := create_buffer("MAIN",input_file); set (NO_WRITE,main_buffer,on); position(main_buffer); build_sdlsemdef; exit