Plan 9 from Bell Labs’s /usr/web/sources/contrib/fernan/nhc98/src/compiler98/GcodeOpt2.hs

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


module GcodeOpt2(gcodeOpt2) where

import Gcode

gcodeOpt2 state gcode = (peephole gcode, state)

peephole (HEAP_ARG i: HEAP_ARG j: RETURN_EVAL: gs) = HEAP_ARG_ARG_RET_EVAL i j: peephole gs
peephole (HEAP_ARG i: HEAP_ARG j: gs) = HEAP_ARG_ARG i j: peephole gs
peephole (g1@(PUSH_ARG i): g2@(ZAP_ARG j): gs)
		| i==j      = PUSH_ZAP_ARG i: peephole gs
		| otherwise = g1: g2: peephole gs
peephole (g:gs) = g: peephole gs
peephole []     = []

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.