-
Notifications
You must be signed in to change notification settings - Fork 2
first pass at a BNFC grammar for the rASL AST format #143
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
base: partial_eval
Are you sure you want to change the base?
Conversation
(targets AbsSemantics.ml LexSemantics.mll ParSemantics.mly SkelSemantics.ml PrintSemantics.ml ShowSemantics.ml TestSemantics.ml BNFC_Util.ml Makefile) | ||
(mode promote) | ||
(enabled_if %{env:ASLP_BNFC_PROMOTE=false})) | ||
; NOTE: bnfc is not run unless ASLP_BNFC_PROMOTE is manually set to `true`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
--makefile
could probably be replaced with a trivial dune executable depending on libASL_bnfc
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree.
libASL/dune
Outdated
(flags (:standard -w -27)) | ||
(modules asl_ast asl_parser asl_parser_pp asl_utils asl_visitor visitor utils value primops symbolic) | ||
(libraries pprint (re_export zarith))) | ||
(libraries pprint (re_export zarith) libASL_bnfc)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably want libSAL_bnfc to be a separate library so that it can be installed independently without Z3?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is, it's just used as a dependency here.
libASL/dune
Outdated
(preprocessor_deps (alias ../asl_files) (alias cpp_backend_files) ../offlineASL/template_offline_utils.ml) | ||
(preprocess (pps ppx_blob)) | ||
(libraries libASL_stage0 libASL_support str mlbdd)) | ||
(libraries libASL_stage0 libASL_support str mlbdd unix)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will unix
break JS?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, yes. That shouldn't be there.
(the AST format is the one that looks like this:
Stmt_ConstDecl(Type_Bits(64),"Cse0__5",Expr_TApply("add_bits.0",...
and is used in gtirb-semantics and BASIL)This adds a BNFC grammar to gain all the benefits of BNFC, most importantly, multi-language parser generator generating. This is the same language which is described in Semantics.g4, but BNFC brings some improvements and I've also just written a better grammar this time.
Some notes:
Tested by running through all the AST outputs in
test_cntlm.t
and also by adding a BNFC parse to the coverage checking. This passes with no problems, so we can be sure that the BNFC grammar describes a superset of the AST which we see in coverage.