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

Use bison for ilasm parser generator #101415

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

hez2010
Copy link
Contributor

@hez2010 hez2010 commented Apr 23, 2024

Supersedes #89704. Fixes #4776.

Bison for Windows: https://github.com/lexxmark/winflexbison
For other platforms: https://www.gnu.org/software/bison

To generate the asmparse.cpp: yacc asmparse.y -o asmparse.cpp (or win_bison asmparse.y -o asmparse.cpp)

I have deleted the asmparse.grammar file as it's no longer being maintained since 2021.

/cc: @TIHan @JulieLeeMSFT

@dotnet-policy-service dotnet-policy-service bot added the community-contribution Indicates that the PR has been added by a community member label Apr 23, 2024
@@ -42,13 +42,13 @@
};

/* These are returned by the LEXER and have values */
%token ERROR_ BAD_COMMENT_ BAD_LITERAL_ /* bad strings, */
Copy link
Contributor Author

@hez2010 hez2010 Apr 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ERROR_ has been defined multiple times, so remove it here.

@@ -96,7 +96,7 @@
%token _CLASS _NAMESPACE _METHOD _FIELD _DATA _THIS _BASE _NESTER
%token _EMITBYTE _TRY _MAXSTACK _LOCALS _ENTRYPOINT _ZEROINIT
%token _EVENT _ADDON _REMOVEON _FIRE _OTHER
%token _PROPERTY _SET _GET DEFAULT_
Copy link
Contributor Author

@hez2010 hez2010 Apr 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DEFAULT_ has been defined multiple times, so remove it here.

Comment on lines +50 to +51
%token <int32> INT32_V /* 3425 0x34FA 0352 */
%token <int64> INT64_V /* 342534523534534 0x34FA434644554 */
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They are conflicting with INT32 and INT64 typedef, so rename them.

@TIHan
Copy link
Member

TIHan commented Apr 26, 2024

Thank you @hez2010 ! Will review this soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-ILTools-coreclr community-contribution Indicates that the PR has been added by a community member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Generate asmparse.c using a standard bison/yacc
2 participants