Questions tagged [fsyacc]

Fsyacc is a F# version of yacc, a program generates a parser (the part of a compiler that tries to make syntactic sense of the source code) based on an analytic grammar written in a notation similar to BNF.

Fsyacc is a F# version of yacc, a program generates a parser (the part of a compiler that tries to make syntactic sense of the source code) based on an analytic grammar written in a notation similar to BNF.

The parser generated by yacc requires a lexical analyzer, which is fslex in the case of fsyacc.

Fsyacc/fslex is shipped as a part of F# PowerPack. For detailed documentation, please visit http://fsharppowerpack.codeplex.com/wikipage?title=FsYacc

See also:

46 questions
3
votes
0 answers

How to setup Visual Studio/JetBrains Rider for interpreter development in F#?

For a while now I have been experiencing issues with configuring IDE`s (Visual Studio and JetBrains Rider) to include FsLexYacc packages and etc. to start learning interpreter development. I have been following this guide at GitHub of how to add…
alex_z
  • 416
  • 5
  • 12
3
votes
1 answer

FsLex aborts with parse error on '{'

My Lexer is supposed to distinguish brackets and maintain a stack of opened brackets during lexing. For this I specified a helper function in my fsl file like this: let updateBracketStack sign = // whenever a bracket is parsed, update the stack…
Friedrich Gretz
  • 535
  • 4
  • 14
3
votes
0 answers

Creating Simple Parser in F#

I am currently attempting to create an extremely simple parser in F# using FsLex and FsYacc. At first, the only functionality I am trying to achieve is allowing the program to take in a string that represents addition of integers and output a…
Avery B
  • 237
  • 1
  • 11
3
votes
0 answers

Creating a Functional Parser in F# using Visual Studio 2013 with FsLex and FsYacc

I have been struggling for a while simply getting a parser to compile and work in F# Visual Studio 2013. I've read a lot of other posts already that seemed helpful, both on stack overflow and this page:…
Jason
  • 108
  • 6
3
votes
1 answer

Can I pass parameters to my fsyacc parser?

I know that it is possible to pass parameters to a lexer: rule tokenize scope = parse | whitespace { tokenize scope lexbuf } | newline { newline lexbuf; tokenize scope lexbuf } but I'm not able to…
enzi
  • 4,057
  • 3
  • 35
  • 53
3
votes
1 answer

How to add and use custom context parameters during parsing with F# FsYacc?

I'm using FsLex and FsYacc for string parsing in F# application. During Abstract Syntax Tree (AST) creation parser has to do a decision how to create the AST (make different trees, throw an exception, etc). The parser behaviour must depend on…
Vitaliy
  • 2,744
  • 1
  • 24
  • 39
2
votes
1 answer

fsyacc errors when building in Visual Studio

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…
Daniel
  • 47,404
  • 11
  • 101
  • 179
2
votes
1 answer

Why is this fsyacc input producing F# that does not compile?

My fsyacc code is giving a compiler error saying a variable is not found, but I'm not sure why. I was hoping someone could point out the issue. %{ open Ast %} // The start token becomes a parser function in the compiled code: %start start //…
Josh Buedel
  • 1,853
  • 16
  • 41
2
votes
1 answer

Should I use Workflow or fsYacc?

I have a very simple DSL I need to parse on a .Net platform. Not being very experienced with parsers, I have been looking at examples using F# (fsLex, fsYacc, FParsec). I am not that familiar with F#, but do have some experience with Workflow and…
John
  • 511
  • 1
  • 5
  • 10
2
votes
1 answer

c -> c# translation, tools

I want to translate a C application to .Net and thinking on how to automate the task. I don't need to "parse" and compile C files, rather I want to re-create a project structure, create a .Net classes corresponding the C files etc. Is there a sense…
2
votes
0 answers

My prebuild event command with reference to a library (from Nuget) does not compile the program

I've been learning F# for some time, and I wanted to try creating a small SQL parser. I have found a tutorial that explains how to do this through FsLex and FsYacc, however, the site does not give any download links. Under Visual Studio, via nuget,…
ino
  • 39
  • 5
2
votes
1 answer

Differentiate between 'minus' operator and negative numbers in F# lex/yacc parser

I am trying to parse a simple script language using FsLex and FsYacc, and I have a problem with distinguishing the minus operator from negative numbers. If I evaluate the term "1 - 2", the parser will return the desired AST:…
Pete
  • 12,206
  • 8
  • 54
  • 70
2
votes
2 answers

fslex lexing javascript regular expressions

I am attempting to lex javascript regular exression literals. These start with a "/" and end with a "/" (and sometimes some other modifiers). The issue is that the only way to determine whether it is a regular expression as opposed to a division…
justin
  • 453
  • 1
  • 4
  • 13
2
votes
1 answer

FSlex/FSyacc crash - can't locate FSharp.Core assembly

I'm having an issue with FSlex/FSyacc crashing on my machine. In context this is inside Visual Studio 11 beta running on Windows 8 Consumer Preview (32 bit) running inside a Parallels virtual machine. ------ Build started: Project: Basis,…
Bent Rasmussen
  • 5,538
  • 9
  • 44
  • 63
1
vote
2 answers

Eliminating shift/reduce errors for binary ops

fsyacc is emitting shift/reduce errors for all binary ops. I have this recursive production: scalar_expr: | scalar_expr binary_op scalar_expr { Binary($2, $1, $3) } Changing it to scalar_expr: | constant binary_op constant { Binary($2,…
Daniel
  • 47,404
  • 11
  • 101
  • 179