Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.compilers > #2179
| From | George Neuner <gneuner2@comcast.net> |
|---|---|
| Newsgroups | comp.compilers |
| Subject | Re: Best language for implementing compilers? |
| Date | 2019-03-10 18:58 -0400 |
| Organization | A noiseless patient Spider |
| Message-ID | <19-03-013@comp.compilers> (permalink) |
| References | <19-02-002@comp.compilers> <19-02-004@comp.compilers> <19-02-006@comp.compilers> <19-03-009@comp.compilers> |
Very nice post! On Sun, 10 Mar 2019 04:13:47 -0700 (PDT), Christopher F Clark <christopher.f.clark@compiler-resources.com> wrote: >Unless you have written a one-pass compiler, the output of your lexer/parser >combination is usually some form of syntax tree (either a parse tree or an >AST). That may or may not be a convenient intermediate representation (IR). >If it's not you need to "rewrite" it into one. Usually making one of more >passes over the tree to do so. > >This is where ML style pattern matching shines. You have a tree (DAG, graph, >some sort of data structure that has links in it) and you want to modify it. >The ML pattern match allows you to specify the shape of the tree you want to >match and extract the relevant parts into convenient local variables. You can >then use those variables to construct a new tree that has the parts >reconnected (rewritten) into the shape you desire in your IR. It also can be useful to use tree matching for code generation: the basic idea being to map the IR onto the instructions of the target machine (where a target "instruction" might be a sequence of native instructions). You create tree patterns that correspond to target "instructions", treat those patterns as tiles and try to cover the IR tree using a minimum "weight" of tiles [where the tile "weight" could be cycles consumed, registers needed, energy used, etc. ... whatever is useful for the given task]. This works with any ISA, but it is particularly useful for CISC machines that often provide more than one way to perform the same operation. The minimum weight tiling will correspond to an optimal program [for some definition of "optimal"]. George
Back to comp.compilers | Previous | Next — Previous in thread | Next in thread | Find similar
Best language for implementing compilers? "Costello, Roger L." <costello@mitre.org> - 2019-02-08 12:20 +0000
Re: Best language for implementing compilers? Nala Ginrut <nalaginrut@gmail.com> - 2019-02-09 00:27 +0800
Re: Best language for implementing compilers? George Neuner <gneuner2@comcast.net> - 2019-02-08 18:36 -0500
Re: Best language for implementing compilers? Bart <bc@freeuk.com> - 2019-02-11 12:59 +0000
Re: Best language for implementing compilers? drb@ihatespam.msu.edu (Dennis Boone) - 2019-02-12 09:38 -0600
Re: Best language for implementing compilers? drb@ihatespam.msu.edu (Dennis Boone) - 2019-02-19 11:22 -0500
Re: Best language for implementing compilers? arnold@skeeve.com (Aharon Robbins) - 2019-02-20 11:48 +0000
Re: Best language for implementing compilers? Kaz Kylheku <157-073-9834@kylheku.com> - 2019-02-12 16:45 +0000
Re: Best language for implementing compilers? mertesthomas@gmail.com - 2019-03-09 01:47 -0500
Re: Best language for implementing compilers? Hans-Peter Diettrich <DrDiettrich1@netscape.net> - 2019-03-09 10:14 +0100
Re: Best language for implementing compilers? George Neuner <gneuner2@comcast.net> - 2019-03-09 22:47 -0500
Re: Best language for implementing compilers? Kaz Kylheku <157-073-9834@kylheku.com> - 2019-03-10 05:40 +0000
Re: Best language for implementing compilers? Bart <bc@freeuk.com> - 2019-03-09 12:34 +0000
Re: Best language for implementing compilers? George Neuner <gneuner2@comcast.net> - 2019-03-09 22:57 -0500
Re: Best language for implementing compilers? Kaz Kylheku <157-073-9834@kylheku.com> - 2019-03-10 05:48 +0000
Re: Best language for implementing compilers? Christopher F Clark <christopher.f.clark@compiler-resources.com> - 2019-03-10 04:13 -0700
Re: Best language for implementing compilers? Bart <bc@freeuk.com> - 2019-03-10 15:33 +0000
Re: Best language for implementing compilers? Christopher F Clark <christopher.f.clark@compiler-resources.com> - 2019-03-11 10:49 -0700
Re: Best language for implementing compilers? Hans-Peter Diettrich <DrDiettrich1@netscape.net> - 2019-03-12 06:54 +0100
Re: Best language for implementing compilers? Bart <bc@freeuk.com> - 2019-03-13 01:50 +0000
Re: Best language for implementing compilers? Hans-Peter Diettrich <DrDiettrich1@netscape.net> - 2019-03-10 16:13 +0100
Re: Best language for implementing compilers? Christopher F Clark <christopher.f.clark@compiler-resources.com> - 2019-03-11 10:06 -0700
Re: Best language for implementing compilers? George Neuner <gneuner2@comcast.net> - 2019-03-10 18:23 -0400
Re: Best language for implementing compilers? George Neuner <gneuner2@comcast.net> - 2019-03-10 18:58 -0400
Re: Best language for implementing compilers? "Robin Vowels" <robin51@dodo.com.au> - 2019-02-09 19:58 +1100
Best language for implementing compilers? David Lovemore <davidlovemore@gmail.com> - 2019-02-12 03:28 -0800
Re: Best language for implementing compilers? mertesthomas@gmail.com - 2019-03-12 10:40 -0700
csiph-web