Skip to content

Commit

Permalink
revise printing production rules in debug mode
Browse files Browse the repository at this point in the history
  • Loading branch information
kwanghoon committed Dec 25, 2022
1 parent 971d76c commit c5be7e3
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 8 deletions.
2 changes: 1 addition & 1 deletion list_of_users.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Applications using YAPB
A list of applications to maintain using YAPB
- arith
- smllike
- polyrpc
Expand Down
4 changes: 2 additions & 2 deletions package.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: yapb
version: 0.2.6
version: 0.2.7
github: "kwanghoon/yapb"
license: BSD3
author: "Kwanghoon Choi"
maintainer: "[email protected]"
copyright: "2020-2021 Kwanghoon Choi"
copyright: "2020-2022 Kwanghoon Choi"

extra-source-files:
- README.md
Expand Down
8 changes: 8 additions & 0 deletions src/parserlib/AutomatonType.hs
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,11 @@ type ActionTable = [((Int, String), Action)] -- key: (Int,String), value: Action
type GotoTable = [((Int, String), Int)] -- key: (Int,String), value: Int
type ProdRules = [(String, [String])] -- key: Int, value: (String, [String])

prProdRule :: (String, [String]) -> String
prProdRule (x,ys) = x ++ " -> " ++ pr_ys ys
where
pr_ys [] = ""
pr_ys [y] = y
pr_ys (y:ys) = y ++ " " ++ pr_ys ys


2 changes: 1 addition & 1 deletion src/parserlib/CommonParserUtil.hs
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,7 @@ runYapbAutomaton flag (am_spec@(AutomatonSpec {

let prodrule = prodRules !! n in

debug flag ("\t" ++ show prodrule) $
debug flag ("\t" ++ prProdRule prodrule) $

let builderFun = pFunList !! n in
let lhs = fst prodrule in
Expand Down
8 changes: 4 additions & 4 deletions yapb.cabal
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
cabal-version: 1.12

-- This file has been generated from package.yaml by hpack version 0.34.4.
-- This file has been generated from package.yaml by hpack version 0.35.0.
--
-- see: https://github.com/sol/hpack
--
-- hash: c133b635fac4f9781f13419abca45b81d467bdf36d792e8884b3a6225a28e571
-- hash: 5a75606bf54164b0ec65ff2140d206d12e6f0515f43690ced0195352f13bab63

name: yapb
version: 0.2.6
version: 0.2.7
synopsis: Yet Another Parser Builder (YAPB)
description: A programmable LALR(1) parser builder system. Please see the README on GitHub at <https://github.com/kwanghoon/yapb#readme>
category: parser builder
homepage: https://github.com/kwanghoon/yapb#readme
bug-reports: https://github.com/kwanghoon/yapb/issues
author: Kwanghoon Choi
maintainer: [email protected]
copyright: 2020-2021 Kwanghoon Choi
copyright: 2020-2022 Kwanghoon Choi
license: BSD3
license-file: LICENSE
build-type: Simple
Expand Down

0 comments on commit c5be7e3

Please sign in to comment.