2

I'm using fsyacc within Visual Studio (using the Parsed Language Starter template), but the build output doesn't show the line/column where the error occured (only: fsyacc exited with code 1). I have to build from the command prompt to get this information, somewhat negating the benefit of VS integration.

Is there a way to show this in the output window?

EDIT

Here are some examples of errors that aren't shown in the output window.

Parser.fsy(74,4): error: parse error

and

building tables
FSYACC: error FSY000: NonTerminal 'query' has no productions

Here's success output that would be nice to see also:

building tables
computing first function...time: 00:00:00.1318603
building kernels...time: 00:00:00.1027372
building kernel table...time: 00:00:00.0533044
computing lookahead relations.............................
..............time: 00:00:00.0517415
building lookahead table...time: 00:00:00.0207993
building action table...state 29: shift/reduce error on AS
state 49: shift/reduce error on OR
state 49: shift/reduce error on AND
...
time: 00:00:00.1457792
building goto table...time: 00:00:00.0035636
returning tables.
39 shift/reduce conflicts
62 states
11 nonterminals
41 terminals
46 productions
#rows in action table: 62
Daniel
  • 47,404
  • 11
  • 101
  • 179
  • It does give red-squiggles in the .fsy file, sort of, some times (might need to clean solution and rebuild). – Stephen Swensen Feb 17 '12 at 17:38
  • I've used fsyacc quite a bit and haven't seen that yet. Maybe my configuration is messed up. – Daniel Feb 17 '12 at 17:39
  • Actually, you may be right, I just tried it out and couldn't create a scenario that produced red-squiggles. But I did get the red-squiggles with my .fsl fslex file, must have been thinking of that. – Stephen Swensen Feb 17 '12 at 17:47
  • @StephenSwensen: I found the red squiggles. The fsy and fsl files must parse first. Once that happens, some errors are highlighted. – Daniel Feb 17 '12 at 19:44
  • Possibly is it that fsyacc is outputting to stderr rather than stdout? I wonder if wrapping it in a script to redirect the output will fix it? – Brian Feb 17 '12 at 20:24
  • @Brian: No, it's going to stdout. – Daniel Feb 17 '12 at 20:27
  • Yeah, when I use fslex/fsyacc it behaves the same way (no detailed output in the Output window). I just have a separate console window open for debugging purposes. It would be nice if this worked, but I guess this is quite a minority feature. – Tomas Petricek Feb 17 '12 at 23:47

1 Answers1

3

Instead of using Parsed Language Starter template, I build parser/lexer by using Pre-build event in Build Events from VS Project Properties:

fslex "$(ProjectDir)Lexer.fsl"
fsyacc --module Grammar "$(ProjectDir)Grammar.fsy"

It is not very desirable since I have to set fsyacc/fslex in Path environment variable. Whenever I don't want to rebuild parser/lexer, I have to comment out the following part in fsproj file:

<PropertyGroup>
  <PreBuildEvent>fslex "$(ProjectDir)Lexer.fsl"
                 fsyacc --module Grammar "$(ProjectDir)Grammar.fsy"
  </PreBuildEvent>
</PropertyGroup>

However, the winning point is clear. We have all messages including errors and success output in stdout which is convenient for debugging.

pad
  • 41,040
  • 7
  • 92
  • 166