sickheadgames / tinypg Goto Github PK
View Code? Open in Web Editor NEWFork of the C# Tiny Parser Generator by Herre Kuijpers.
Fork of the C# Tiny Parser Generator by Herre Kuijpers.
With the new features that are made available in this version, not all are implemented in the VBNET template
Example line number is not emplemented or is atleast not working
i have this Grammar: Grammar
i have the problem that the code generator generates 2 same IDENTIFIER switch cases. When i delete the empty one it parses not correctly.
add generic compilation instead of codedom compiler, example ironpython
I could be wrong, but I'm pretty sure this is a bug in TinyPG. It isn't able to properly parse this grammar:
EOF -> @"^\s_$";
[Skip] WHITESPACE -> @"\s+";
LIST -> "LIST";
END -> "END";
IDENTIFIER -> @"[a-zA-Z_][a-zA-Z0-9_]_";
Expr -> LIST IDENTIFIER+ END;
Start -> (Expr)+ EOF;
The resulting parser cannot parse this:
LIST foo BAR Baz END
because it greedily lexes END as an IDENTIFIER, instead of properly as the END keyword.
Currently it generates a comment like this:
// Generated by TinyPG v1.3 available at www.codeproject.com
It should probably be more like this:
// Automatically generated from source file: ../../Relative/Path/MyParserSourceFile.tpg
// By TinyPG v1.3 available at http://github.com/SickheadGames/TinyPG
First of all, thanks so much for putting this up on GitHub! I just discovered TinyPG and it looks like a great tool.
I compared to the code from TinyPG 1.3 on CodeProject and your version on GitHub. It looks like you added a new "string fileName" argument to the Parser.Parse methods in the C# templates. This seems like a really good idea; however, it's causing problems in the TinyPG IDE. When I push F5 (Generage&Run), I get an exception.
I traced the error down to line 157 in Compiler.cs:
object treeinstance = parsertype.InvokeMember("Parse", BindingFlags.InvokeMethod, null, parserinstance, new object[] { input });
The problem is that the parser no longer contains a .Parse method that only takes one parameter. To get things working, I added a dummy filename argument to line 157:
object treeinstance = parsertype.InvokeMember("Parse", BindingFlags.InvokeMethod, null, parserinstance, new object[] { input, "DummyFileName" });
I think a better solution though would be to add an overload for .Parse that only takes one parameter, the input string to parse. A lot of people will probably use TinyPG to generate parsers for interactive use, where there is no filename.
Thanks again for your work on this project!
Add a command line tool which can be used from Visual Studio for generation on the fly.
Generate documentation which explains how it all works and includes the latest features.
We should start by using most of the original article 'A Tiny Parser Generator v1.2' on CodeProject.
We should then add the new features to it.
Need to figure out how to best package these docs and easily launch them from the editor.
add vs code generator and extension with highlighting
Hook up the unit tests to the automated build process.
When running TinyPG with a file parameter
cmd.exe : NO console output displayed.
VS2010 : console output displayed in output window.
I found/tried this solution on stackOverflow.
http://stackoverflow.com/questions/8047741/attachconsole-1-but-console-writeline-wont-output-to-parent-command-prompt
It causes the reverse behavior
cmd.exe : console output displayed.
VS2010 : console output displayed in a cmd.exe console which close upon completion. output window is blank.
Setting TinyPG project to "Console application" instead of "Window application" seems to fix the problem :
output are displayed in VS2010/batch/cmd.exe correctly.
TinyPG.csproj
- <OutputType>WinExe</OutputType>
+ <OutputType>Exe</OutputType>
But i am not totaly sure/aware of the consequences.
pls add generic code generation to add code generator per plugin
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.