Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix similar function header parsing error #75

Merged
merged 5 commits into from
Jan 26, 2025

Conversation

rycont
Copy link
Owner

@rycont rycont commented Jan 26, 2025

약속, 회전하기
    각도 + "도 회전하기" 보여주기

약속, (시간)초 동안 (각도)도 회전하기
    시간 + "초 동안 " + 각도 + "도 회전하기" 보여주기

배열: [1, 2, 3, 4, 5]
배열[2]초 동안 90도 회전하기

다음의 경우에 재현되는 오류임

  1. 다른 함수의 정의 헤더를 완전히 포함하는 함수가 존재함
  2. 포함되는 함수는 인자를 받지 않음
  • 또는 이를 포함하는 함수 호출에서 이 인자에 상응하는 위치에 ValueLiteral을 전달함
  1. 함수의 호출에서 인자에 ValueLiteral이 아닌 값을 전달함

이 경우에, ValueLiteral이 아닌 값(3에서 인자에 전달한 값)은 아직 Node[]로 평가되기에 Evaluable이 되지 않아 의도한 함수 호출 파싱이 진행되지 않음. 이후 작은 함수 헤더가 먼저 파싱이 진행되어, 이후 큰 함수는 올바르게 파싱되지 않음.

현재 파싱 규칙은 DynamicRules -> BasicRules -> AdvancedRules(Statements) 순서로 진행됨. 이중 함수 호출 & 정의는 DynamicRules에 정의되며, 이를 BasicRules 이후로 미룰 필요가 있었음. 그렇기에 BasicRules -> DynamicRules -> AdvancedRules 순서로 파싱 우선순위를 변경하였음.

그러나 이 경우 함수(약속, 번역) 정의에서 문제가 발생함. 정의문의 일부가 BasicRules로 파싱되는 경우가 발생하여, 이를 방지하지 위해 함수 정의는 따로 분리하여 BasicRules보다 먼저 파싱할 필요가 생겼음. 그렇기에 DynamicRules를 생성하는 함수에서 1순위와 차순위를 분리하여, 1순위엔 함수 정의 문법을 포함함.

이후 파싱 규칙을 DeclareRules -> BasicRules -> InvokingRules -> AdvancedRules 순서로 수정하여, 올바르게 파싱되는 것을 확인함.

@rycont rycont merged commit 222c446 into main Jan 26, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant