[gen] Introduce a new relaxation/edge/atom parser in diy tool.#1685
Open
ShaleXIONG wants to merge 1 commit intoherd:masterfrom
Open
[gen] Introduce a new relaxation/edge/atom parser in diy tool.#1685ShaleXIONG wants to merge 1 commit intoherd:masterfrom
diy tool.#1685ShaleXIONG wants to merge 1 commit intoherd:masterfrom
Conversation
ce28381 to
15b8202
Compare
15b8202 to
19da623
Compare
- We introduce new choice syntax `|`. For example `PosWR|DpAddrdW` means either `PosWR` or `DpAddrdW`. This can be used in `diycross7` and `diy7`. In `diyone7`, although it will be parsed however an error occurs due to input is not a precise one cycle. - The new `parser.mly` and `lexer.mll` combination parses the input cycle into `Ast.t`. - Unify the paring process cross three `diy*` tools.
19da623 to
509b397
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a first phrase to rework on the
diy*lexer and parser on input relaxations or cycles. In this pull request we introduce a more conventional way, that is, (1) newlexer.mlltokenises input to an AST, specifically typetin newast.mland (2) newparser.mlyparses the AST to internal data structure. Note that we keep the oldlexutil.mllfor backward compatibility, and this file will be remove for next phrase.In the
Ast.t, individual primitive relaxation is represented byOne of string. The consequence of relaxation is represented bySeq of t list; this corresponds to,syntax or in some situation, white space. For examplediyone7 PosWR PosRR Friis equivalent todiyone7 PosWR,PosRR,Fri. We also introduce aChoicecontractor, together with a new syntax|. For examplePosWR|DpAddrdWmeans eitherPosWRorDpAddrdW. This can be used indiycross7anddiy7. Indiyone7, although it will be parsed however an error occurs due to input is not a precise one cycle. The future plan is to gradually deprecates onlydiycross7syntax.for example
diycross7 Po,DpAddr Rfi,Fri,Coiis in fact meansdiycross7 Po|DpAddr Rfi|Fri|Coi.Last, Given all the chances above, we unify the paring process cross three
diy*tools. Previously differentdiy*has different parsing path and the actual code are in different files. Now the main passing function unifies atparse_expand_relaxandparse_expand_relaxsinrelax.ml. The future plan is to remove thePpotype as it is only used inPPCCompile_gen.mlas a special wildcard. However the current parsing is after we flatten theAst.tto astring list list, so we can hook to the existing parsing functions. The future plan is to parametrise the typeAst.t, so we can directly parse on theAst.t.