Transcript
Page 1: An Automatic Generation of Dynamic Finite State Automata Parser for VMF

An Automatic Generation of Dynamic Finite State Automata Parser for VMF

Page 2: An Automatic Generation of Dynamic Finite State Automata Parser for VMF

Objectives

• VMF 급 메시지를 위한 동적 FSA 파서 개발– 효율적이고 정확한 메시지 처리– 의미 분석을 위한 동적 State Diagram 구성

• 메시지 기반의 파서 생성기 개발– 높은 유연성과 유지 보수성을 지향– 최대한으로 자동화된 VMF 파서 개발을 지원

Page 3: An Automatic Generation of Dynamic Finite State Automata Parser for VMF

Key Features

• 입력 : RE, DNF 등으로 구성된 FVMF• 출력 : 메시지 기반 파서의 C 소스 코드

• FVMF 는 Text 또는 C structure 등의 다양한 형식으로 저장됨 .

• 파서 생성기 또한 다양한 입력 형식을 지원 .• 생성된 파서는 Syntactic 분석과 Semantic

분석을 동시에 수행 .• 메모리 최적화의 단계적 설정이 가능

Page 4: An Automatic Generation of Dynamic Finite State Automata Parser for VMF

FSA Parser for VMF

0110101101100…

Start Dataε

G1

G4

BIT(1)

F1

0

1

1

0

F2

Data

BIT(9)

10

0110101101100…0110101101100…0110101101100…

0

0110101101100…

0

0110101101100…0110101101100…0110101101100…

1

0110101101100…0110101101100…

Page 5: An Automatic Generation of Dynamic Finite State Automata Parser for VMF

Parser (overall)

• 크게 세 부분으로 구성– State Data Structures

• State Diagram 을 Data Structure 로 표현• State, Transition, 처리 규칙 등을 포함

– State Callback Functions– Process Routines

• Non-dynamic procedures• Scripts (Makefile, etc.)

Page 6: An Automatic Generation of Dynamic Finite State Automata Parser for VMF

Parser (Data Structures)

• State and Transition– 한 state 는 조건을 수반한 여러 transition 들을 가짐– 한 transition 은 하나의 state 를 ‘ next state’ 로 가짐

• 처리 규칙– 데이터 구조는 아직 미정

typedef struct state {int num_transitions;Transition** transition;

} State;

typedef struct transition {int condition;State* next_state;

} Transition;

Page 7: An Automatic Generation of Dynamic Finite State Automata Parser for VMF

Parser (Callback Function)

• 각 State 에서 필요한 동작들을 함수로 정의

• Callback 함수를 사용하여 필요할 때마다 호출

• 함수 내에서 가능한 Action– 메시지 필드 해석– 메시지 필드 데이터 대조– 메모리 할당– 메모리 할당 해제– Etc.

Page 8: An Automatic Generation of Dynamic Finite State Automata Parser for VMF

Parser (Callback Function)

• 각 state 는 담당 함수의 pointer 를 보유

typedef struct state {int num_transitions;

int (*function)();

Transition** transition;} State;

typedef struct transition {int condition;State* next_state;

} Transition;

Page 9: An Automatic Generation of Dynamic Finite State Automata Parser for VMF

Parser (Processing Routine)

• 동적 생성이 필요하지 않은 정적인 부분– Data Structure 에 맞추어 Parsing 을 진행– Data Structure 에 맞추어 State Diagram 을

동적으로 변경– 메시지 입력 , 버퍼 관리 , 메시지 해석 결과 출력– 생성된 소스 코드의 Compile Script– 기타 Resource

Page 10: An Automatic Generation of Dynamic Finite State Automata Parser for VMF

Parser (Processing Routine)

• 핵심 동작의 알고리즘은 정적으로 구현

State* cur_State = startState;

While (cur_State->num_transitions != 0) { for (i = 0; i <= cur_State->num_transitions; i++)

if (cur_Condition == cur_State->transitions[i]->condition) {nextState

= cur_state->transitions[i]->next_state;

break; }

cur_state->function();cur_state = nextState;

}

Page 11: An Automatic Generation of Dynamic Finite State Automata Parser for VMF

Memory Optimization

• 모든 state 들의 메모리를 미리 할당하는 경우 많은 메모리가 요구될 수 있음

• 동적이고 효율적인 메모리 관리– 처리가 끝난 state 들은 메모리 Free– 앞으로 처리될 state 들 동적으로 할당

• Sliding Window 개념 도입– Window size 의 조정으로 메모리 최적화의 단계를

설정 가능

Page 12: An Automatic Generation of Dynamic Finite State Automata Parser for VMF

Generator Structure

FVMFPreprocessor

Data Structure Generator

Callback Function

Generator

Processing Routines

Writer

INPUT OUTPUTPROCESSING

Page 13: An Automatic Generation of Dynamic Finite State Automata Parser for VMF

Future Work

• 향상된 Automata 를 구현한 관련 연구 Survey

• 처리 규칙을 포함한 Semantic 분석 알고리즘 연구

• Sliding Window 알고리즘의 적용

• Requirement Specification 및 기타 Design 문서 작성

• Parser 의 시범적 구현


Recommended