Search Results

Search found 61 results on 3 pages for 'grammars'.

Page 1/3 | 1 2 3  | Next Page >

  • How do I best do balanced quoting with Perl's Regexp::Grammars?

    - by Evan Carroll
    Using Damian Conway's Regexp::Grammars, I'm trying to match different balanced quoting ('foo', "foo", but not 'foo") mechanisms -- such as parens, quotes, double quotes, and double dollars. This is the code I'm currently using. <token: pair> \'<literal>\'|\"<literal>\"|\$\$<literal>\$\$ <token: literal> [\S]+ This generally works fine and allows me to say something like: <rule: quote> QUOTE <.as>? <pair> My question is how do I reform the output, to exclude the needles notation for the pair token? { '' => 'QUOTE AS \',\'', 'quote' => { '' => 'QUOTE AS \',\'', 'pair' => { 'literal' => ',', '' => '\',\'' } } }, Here, there is obviously no desire to have pair in between, quote, and the literal value of it. Is there a better way to match 'foo', "foo", and $$foo$$, and maybe sometimes ( foo ) without each time creating a needless pair token? Can I preprocess-out that token or fold it into the above? Or, write a better construct entirely that eliminates the need for it?

    Read the article

  • "Arbitrary" context free grammars?

    - by danwroy
    Long time admirer first time inquirer :) I'm working on a program which derives a deterministic finite-state automata from a context-free grammar, and the paper I have been assigned which explains how to do this keeps referring to "arbitrary probabilistic context-free grammars" but never defines the meaning of "arbitrary" in relation to PCFGs. I assume they mean "any old PCFG" but then why not just say "any PCFG"? The term also turns up in several Wikipedia entries. At the top of the CFG page there is a reference to arbitrariness in relation to CFGs on ("clauses can be nested inside clauses arbitrarily deeply"), but doesn't make clear why someone would refer to a PCFG or subset of PCFGs as arbitrary. In case anyone is curious, the paper is Parsing and Hypergraphs by Klein and Manning (2001); I've also been reading two other papers by them related to this one (An Agenda-Based Chart Parser for Arbitrary Probabilistic Context-Free Grammars and Empirical Bounds, Theoretical Models, and the Penn Treebank) which use the term extensively but never explain it either. Thanks for your help!

    Read the article

  • Using perl's Regexp::Grammars, how do I make a capture dependent on $MATCH?

    - by Evan Carroll
    I've got a token like such: <delim2=((?{ $MATCH{delim} }))> and what I want to happen is for delim2 to capture and be set to the value of delim. When I run this, delim2 is set, but the capture is never done. I think this is an error in my reasoning: I'm trying to chain this form: <ALIAS= ( PATTERN )> Match pattern, save match in $MATCH{ALIAS} and this form: (?{ MATCH{delim} }) into something like this <ALIAS= ( (?{MATCH{delim}) )> Matches the value of $MATCH{delim} save to $MATCH{delim2} but this simply doesn't seem valid. I can verify my original token works <delim2=((?{ die $MATCH{delim} }))> will die with the value, and, if I hard code it, I get the right capture and everything works <delim2=(')>? So how do I go about achieving sane results, while having a dynamic pattern?

    Read the article

  • Parse tree and grammars information

    - by fuzzylogikk
    Do anyone know where to find good online resources with examples how to make grammars and parsetrees? Preferebly introductary materials. Info that is n00b friendly, haven't found anything good with google myself. edit: I'm thinking about theory, not a specific parser software.

    Read the article

  • Generating n statements from context-free grammars

    - by Dervin Thunk
    Hello, So not to reinvent the wheel, I would like to know what has already been done about generating random statements from a context-free language (like those produced by yacc, etc.). These grammars are primarily for parsing, but maybe someone has done some generation for testing the parsers? Thanks

    Read the article

  • Is there a well grounded theory on backward and forward compatibility of formats, languages, grammars and vocabularies?

    - by Breton
    I have a friend who has the specific problem of building a case against the use of a custom HTML <wrapper> tag in some site's markup. Now, intuitively we can answer that use of such a tag is risky, as future HTML specs may define a wrapper tag with semantics that conflict with its use on the site. We can also appeal to a particular section of the HTML5 spec which also recommends against the use of custom tags for this reason. And while I agree with the conclusion, I find these arguments a little on the weak side, on their own. Is there some well grounded and proven theory in computer science from which we can derive this conclusion? Have programming language theorists created proofs about the properties of vocabulary versioning, or some such thing?

    Read the article

  • Java: how to tell if a line in a text file was supposed to be blank?

    - by defn
    I'm working on a project in which I have to read in a Grammar file (breaking it up into my data structure), with the goal of being able to generate a random "DearJohnLetter". My problem is that when reading in the .txt file, I don't know how find out whether the file was supposed to be a completely blank line or not, which is detrimental to the program. Here is an example of part of the file, How do i tell if the next line was supposed to be a blank line? (btw I'm just using a buffered reader) Thanks! <start> I have to break up with you because <reason> . But let's still <disclaimer> . <reason> <dubious-excuse> <dubious-excuse> , and also because <reason> <dubious-excuse> my <person> doesn't like you I'm in love with <another> I haven't told you this before but <harsh> I didn't have the heart to tell you this when we were going out, but <harsh> you never <romantic-with-me> with me any more you don't <romantic> any more my <someone> said you were bad news

    Read the article

  • What does =*> mean with regards to context free grammars?

    - by incrediman
    I've been reading a couple books/online references about compiler theory, and keep seeing that particular operator coming up every once in a while (as seen here), specifically when the current topic is context free grammars. What does it mean? As well, how does it differ from =>? Explanations with examples distinguishing => from =*> would be most helpful.

    Read the article

  • Difference between an LL and Recursive Descent parser?

    - by Noldorin
    I've recently being trying to teach myself how parsers (for languages/context-free grammars) work, and most of it seems to be making sense, except for one thing. I'm focusing my attention in particular on LL(k) grammars, for which the two main algorithms seem to be the LL parser (using stack/parse table) and the Recursive Descent parser (simply using recursion). As far as I can see, the recursive descent algorithm works on all LL(k) grammars and possibly more, whereas an LL parser works on all LL(k) grammars. A recursive descent parser is clearly much simpler than an LL parser to implement, however (just as an LL one is simply than an LR one). So my question is, what are the advantages/problems one might encounter when using either of the algorithms? Why might one ever pick LL over recursive descent, given that it works on the same set of grammars and is trickier to implement? Hopefully this question makes some amount of sense. Sorry if it doesn't - I blame my the fact that this entire subject is almost entirely new to me.

    Read the article

  • Parsing: How to make error recovery in grammars like " a* b*"?

    - by Lavir the Whiolet
    Let we have a grammar like this: Program ::= a* b* where "*" is considered to be greedy. I usually implement "*" operator naively: Try to apply the expression under "*" to input one more time. If it has been applied successfully then we are still under current "*"-expression; try to apply the expression under "*" one more time. Otherwise we have reached next grammar expression; put characters parsed by expression under "*" back into input and proceed with next expression. But if there are errors in input in any of "a*" or "b*" part such a parser will "think" that in position of error both "a*" and "b*" have finished ("let's try "a"... Fail! OK, it looks like we have to proceed to "b*". Let's try "b"... Fail! OK, it looks like the string should have been finished...). For example, for string "daaaabbbbbbc" it will "say": "The string must end at position 1, delete superflous characters: daaaabbbbbbc". In short, greedy "*" operator becomes lazy if there are errors in input. How to make "*" operator to recover from errors nicely?

    Read the article

  • What does "context-free" mean in the term "context-free grammar"?

    - by rick
    Given the amount of material that tries to explain what a context-free grammar (CFG) is, I found it surprising that very few (in my sample, less than 1 in 20) give an explanation on why such grammars are called "context-free". And, to my mind, none succeeds in doing so. My question is, why are context-free grammars called context-free? What is "the context"? I had an intuition that the context could be other language constructs surrounding the currently analyzed construct, but that seems not to be the case. Could anyone provide a precise explanation?

    Read the article

  • How is parsing phase in a compiler different from a rule engine ?

    - by abhinav
    Hi, I have a rough understanding of how the compilers work (I mean languages, grammars, lexical analysis, parsing etc). The rule engines have various rules and associated action, just like you have rules in the grammars and you can associate actions with them in parser-generator tools like ANTLR. So I am a bit confused on how to differentiate between these two. Could anyone give a clearer, more formal explanation for the differences ? Thanks, Abhinav.

    Read the article

  • Design a mini script language

    - by radi
    hi , my project this year is to develop a text mining tool (with new features) so we need a mini script language in this tool to add annotation to texts this language should be simple and like lisp grammars (left and right side) . what i need is how to design this language ,i know how to constract the compiler , but how to write language grammars ? , and i want to use some mini open source language or any language bnf please advice me and if there is a language i can use and customize to meet my needs ? thanks

    Read the article

  • How to mix Grammar (Rules) & Dictation (Free speech) with SpeechRecognizer in C#

    - by Lee Englestone
    I really like Microsofts latest speech recognition (and SpeechSynthesis) offerings. http://msdn.microsoft.com/en-us/library/ms554855.aspx http://estellasays.blogspot.com/2009/04/speech-recognition-in-cnet.html However I feel like I'm somewhat limited when using grammars. Don't get me wrong grammars are great for telling the speech recognition exactly what words / phrases to look out for, however what if I want it to recognise something i've not given it a heads up about? Or I want to parse a phrase which is half pre-determined command name and half random words? For example.. Scenario A - I say "Google [Oil Spill]" and I want it to open Google with search results for the term in brackets which could be anything. Scenario B - I say "Locate [Manchester]" and I want it to search for Manchester in Google Maps or anything else non pre-determined I want it to know that 'Google' and 'Locate' are commands and what comes after it are parameters (and could be anything). Question : Does anyone know how to mix the use of pre-determined grammars (words the speech recognition should recognise) and words not in its pre-determined grammar? Code fragments.. using System.Speech.Recognition; ... ... SpeechRecognizer rec = new SpeechRecognizer(); rec.SpeechRecognized += rec_SpeechRecognized; var c = new Choices(); c.Add("search"); var gb = new GrammarBuilder(c); var g = new Grammar(gb); rec.LoadGrammar(g); rec.Enabled = true; ... ... void rec_SpeechRecognized(object sender, SpeechRecognizedEventArgs e) { if (e.Result.Text == "search") { string query = "How can I get a word not defined in Grammar recognised and passed into here!"; launchGoogle(query); } } ... ... private void launchGoogle(string term) { Process.Start("IEXPLORE", "google.com?q=" + term); }

    Read the article

  • How to add words to an already loaded grammar using System.Speech and SAPI 5.3

    - by Kim Major
    Given the following code, Choices choices = new Choices(); choices.Add(new GrammarBuilder(new SemanticResultValue("product", "<product/>"))); GrammarBuilder builder = new GrammarBuilder(); builder.Append(new SemanticResultKey("options", choices.ToGrammarBuilder())); Grammar grammar = new Grammar(builder) { Name = Constants.GrammarNameLanguage}; grammar.Priority = priority; _recognition.LoadGrammar(grammar); How can I add additional words to the loaded grammar? I know this can be achieved both in native code and using the SpeechLib interop, but I prefer to use the managed library. Update: What I want to achieve, is not having to load an entire grammar repeatedly because of individual changes. For small grammars I got good results by calling _recognition.RequestRecognizerUpdate() and then doing the unload of the old grammar and loading of a rebuilt grammar in the event: void Recognition_RecognizerUpdateReached(object sender, RecognizerUpdateReachedEventArgs e) For large grammars this becomes too expensive.

    Read the article

  • How do Scala parser combinators compare to Haskell's Parsec?

    - by artif
    I have read that Haskell parser combinators (in Parsec) can parse context sensitive grammars. Is this also true for Scala parser combinators? If so, is this what the "into" (aka "") function is for? What are some strengths/weaknesses of Scala's implementation of parser combinators, vs Haskell's? Do they accept the same class of grammars? Is it easier to generate error messages or do other miscellaneous useful things with one or the other? How does packrat parsing (introduced in Scala 2.8) fit into this picture? Is there a webpage or some other resource that shows how different operators/functions/DSL-sugar from one language's implementation maps onto the other's?

    Read the article

  • Need help starting with DSL for charts/graphs

    - by Rex M
    I am unaware of any established work into Domain Specific Languages for describing charts / graphs. I am looking for specific answers of "yes, something like that exists (here)". To help be clear, in case I am possibly using the wrong verbiage to describe it, to me a DSL for charts would most certainly include: A grammar for describing the shape of an expected data set A grammar for describing a pipeline of behaviors that render an output Abstract / high-level enough to be mappable to most tool-specific grammars, such as Excel, Highchart, matplotlib, etc.

    Read the article

  • CodePlex Daily Summary for Saturday, March 31, 2012

    CodePlex Daily Summary for Saturday, March 31, 2012Popular ReleasesAuto-LiMPoT: Auto-LiMPoT - v.1.1 - binary: Changelog: +Now patches updater-script with correct packager name and version number +Added option to choose position of java.exe manually if not found automaticallyExtended WPF Toolkit: Extended WPF Toolkit - 1.6.0: Want an easier way to install the Extended WPF Toolkit?The Extended WPF Toolkit is available on Nuget. What's in the 1.6.0 Release?BusyIndicator ButtonSpinner Calculator CalculatorUpDown CheckListBox - Breaking Changes CheckComboBox - New Control ChildWindow CollectionEditor CollectionEditorDialog ColorCanvas ColorPicker DateTimePicker DateTimeUpDown DecimalUpDown DoubleUpDown DropDownButton IntegerUpDown Magnifier MaskedTextBox MessageBox MultiLineTex...ScriptIDE: Release 4.4: ...Media Companion: MC 3.434b Release: General This release should be the last beta for 3.4xx. If there are no major problems, by the end of the week it will upgraded to 3.500 Stable! The latest mc_com.exe should be included too! TV Bug fix - crash when using XBMC scraper for TV episodes. Bug fix - episode count update when adding new episodes. Bug fix - crash when actors name was missing. Enhanced TV scrape progress text. Enhancements made to missing episodes display. Movies Bug fix - hide "Play Trailer" when multisaev...Better Explorer: Better Explorer 2.0.0.831 Alpha: - A new release with: - many bugfixes - changed icon - added code for more failsafe registry usage on x64 systems - not needed regfix anymore - added ribbon shortcut keys - Other fixes Note: If you have problems opening system libraries, a suggestion was given to copy all of these libraries and then delete the originals. Thanks to Gaugamela for that! (see discussion here: 349015 ) Note2: I was upload again the setup due to missing file!XAML Dialect Comparer Tool: Beta 1: This is a first beta version of this tool (as shown at DevConncetions in Vegas, March 2012). Community participation and suggestions are appreciated.LINQ Extensions Library: 1.0.2.7: Append and Prepend extensions (1.0.2.7) IndexOf extensions (1.0.2.7) New Align/Match extensions (1.0.2.6) Ready to use stable code with comprehensive unit tests and samples New Pivot extensions New Filter ExtensionsMonoGame - Write Once, Play Everywhere: MonoGame 2.5: The MonoGame team are pleased to announce that MonoGame v2.5 has been released. This release contains important bug fixes, implements optimisations and adds key features. MonoGame now has the capability to use OpenGLES 2.0 on Android and iOS devices, meaning it now supports custom shaders across mobile and desktop platforms. Also included in this release are native orientation animations on iOS devices and better Orientation support for Android. There have also been a lot of bug fixes since t...callisto: callisto 2.0.23: Patched Script static class and peak user count bug fix.Circuit Diagram: Circuit Diagram 2.0 Alpha 3: New in this release: Added components: Microcontroller Demultiplexer Flip & rotate components Open XML files from older versions of Circuit Diagram Text formatting for components New CDDX syntax Other fixesUmbraco CMS: Umbraco 5.1 CMS (Beta): Beta build for testing - please report issues at issues.umbraco.org (Latest uploaded: 5.1.0.123) What's new in 5.1? The full list of changes is on our http://progress.umbraco.org task tracking page. It shows items complete for 5.1, and 5.1 includes items for 5.0.1 and 5.0.2 listed there too. Here's two headline acts: Members5.1 adds support for backoffice editing of Members. We support the pairing up of our content type system in Hive with regular ASP.NET Membership providers (we ship a def...51Degrees.mobi - Mobile Device Detection and Redirection: 2.1.2.11: One Click Install from NuGet Changes to Version 2.1.2.11Code Changes 1. The project is now licenced under the Mozilla Public Licence 2. 2. User interface control and associated data access layer classes have been added to aid developers integrating 51Degrees.mobi into wider projects such as content management systems or web hosting management solutions. Use the following in a web form or user control to access these new UI components. <%@ Register Assembly="FiftyOne.Foundation" Namespace="...JSON Toolkit: JSON Toolkit 3.1: slight performance improvement (5% - 10%) new JsonException classPicturethrill: Version 2.3.28.0: Straightforward image selection. New clean UI look. Super stable. Simplified user experience.SQL Monitor - managing sql server performance: SQL Monitor 4.2 alpha 16: 1. finally fixed problem with logic fault checking for temporary table name... I really mean finally ...ScintillaNET: ScintillaNET 2.5: A slew of bug-fixes with a few new features sprinkled in. This release also upgrades the SciLexer and SciLexer64 DLLs to version 3.0.4. The official stuff: Issue # Title 32402 32402 27137 27137 31548 31548 30179 30179 24932 24932 29701 29701 31238 31238 26875 26875 30052 30052 Mugen MVVM Toolkit: Mugen MVVM Toolkit ver 1.1: Added Design mode support.Harness: Harness 2.0.2: change to .NET Framework Client Profile bug fix the download dialog auto answer. bug fix setFocus command. add "SendKeys" command. remove "closeAll" command. minor bugs fixed.BugNET Issue Tracker: BugNET 0.9.161: Below is a list of fixes in this release. Bug BGN-2092 - Link in Email "visit your profile" not functional BGN-2083 - Manager of bugnet can not edit project when it is not public BGN-2080 - clicking on a link in the project summary causes error (0.9.152.0) BGN-2070 - Missing Functionality On Feed.aspx BGN-2069 - Calendar View does not work BGN-2068 - Time tracking totals not ok BGN-2067 - Issues List Page Size Bug: Index was out of range. Must be non-negative and less than the si...YAF.NET (aka Yet Another Forum.NET): v1.9.6.1 RTW: v1.9.6.1 FINAL is .NET v4.0 ONLY v1.9.6.1 has: Performance Improvements .NET v4.0 improvements Improved FaceBook Integration KNOWN ISSUES WITH THIS RELEASE: ON INSTALL PLEASE DON'T CHECK "Upgrade BBCode Extensions...". More complete change list and discussion here: http://forum.yetanotherforum.net/yaf_postst14201_v1-9-6-1-RTW-Dated--3-26-2012.aspxNew ProjectsAlloCiné API: API AlloCiné v3 This is a library to use the API of AlloCiné. It covers the version 3 of the AlloCiné service as described here GroWiki API AlloCiné v3. The data-interchange format used behind the scene is JSON. Auto-LiMPoT: An automated tool to convert an N1 MIUI Rom to an AcerLiquid-compatible Rom.Azure Management API (via F#): This lib is a wrapper for Azure Management REST API. Can be used by .Net languages but adapted for F# (used asyncs and other). Supported operations: AffinityGroups (all), HostedServices (all), StorageServices (all), Azure Sql (all = manage server + firewall rules), AsyncOperationCraigsPack: This is a Light weight and Expandable library that helps search through craigslist ads but not bound to only one website. It includes interfaces and base classes to help create custom web providers for other specific websites. Written in c#Cygnus v3: Cygnus internal.DataHelperCS: Porject about DataHelper for rapid development and Simplist Architectur Model.Datewise Picture Arranger: Arranges/Renames pictures based on the date taken. d? án web: Ð? án môn phát tri?n ?ng d?ng webDrawbot: IRC Bot for /r/sketchdaily on reddit.FONIS prezenter: FONIS prezenter je aplikacija koja omogucava korisniku da odredenom kombinacijom sa tastature pozove odgovarajucu PowerPoint prezentaciju. Program je razvijen u C#. Za instaliranje i pokretanje ovog programa, potrebno je instalirati .NET Framework 4. Grammars: Grammars makes it easy to design regular, context-free and context-dependent grammars and apply various tools for parsing and language analysis. It is developed in C# and provides a BNF-like syntax with operator overloading and semantic rules as delegates, allowing you to design and code your grammar right in the middle of your C# code. It fleets with a fully-functional LR parser generator.iConference: Conference Management System.IQCare: IQCare is a Open Source, data capture and reporting system with patient management tools designed to measure patient outcomes. Having the ability to analyze data and then use the resulting analysis to provide improved care is the end goal of IQCare. IQCare has all of the key features needed to collect clean data and to do patient and facility analysis and reporting.Memory Management: General purpose memory management in C++ with policy-based architecture.Metro Style App Study Project: Metro Style App demos from QQ Group 95331609OpenNETCF CAB Installer SDK: The OpenNETCF CAB Installer SDK provides programmatic access to the extraction of CAB files under Windows CE, Windows Mobile, Windows Embedded Compact and Windows Embedded HandheldOrchard Private Content: Allows content items to be displayed by only users with roles that have permission.Pete Brown NETMF and Gadgeteer Code: Module drivers and other code for my .NET Micro Framework projects.QuanLyBanHang-Nhom100: Qu?n lý bán hàng - nhóm 100 Bùi vi?t sang Nguy?n van longRegeXml: This is about a Framework that allow you to transform a bunch of dirty data into a one and well formated XML.SSIS Row Number Component: This Rownumber component allows you to add a rownumber in the case your destination doesn't support auto-increment.Sunburn XNA advanced help custom samples: This project will include samples I do using sunburns engine. If you use it correctly it is a very powerful engine i found out. I will post samples for things that people have been trying to do in xna 4 and above with sunburn for awhile. THE webpage: gffgfgdhhgghdj91Transbin for anyone: Transbin makes it easier to contorl your computer anywhere.Wazzup module for DotNetNuke: Wazzup is a simple module for the DotNetNuke CMS to display the newest content added to your site. It leverage's DNN's search indexer and displays a simple link with publishing date and text summary. Developed in VB. Fits well into narrow vertical content areasWLCompus: WLCompusXNA Game Studio 3.0 Unleashed Book Source Code: C# Source Code and Assets from the XNA Game Studio 3.0 Unleashed book. The code is released under the Ms-PL license.

    Read the article

  • Good Intro to Computer Science Book for FE Developer [on hold]

    - by Squirkle
    I am a JavaScript developer/architect who, like many developers these days, did not come from a Computer Science background (I studied Philosophy at a liberal arts college), but instead learned development by actually building applications, and by reading books explaining language grammars, design patterns, and best practices. I have never felt that my ignorance of CS concepts has hurt my ability to build great apps or find employment. Recently, however, I have felt the itch to grow in this direction. Do you have any suggestions for some good introductory CS resources/books? I know that Computer Science is a huge field and my question is very general, but I am looking for a 101-type survey of the high-level concepts, from which I can branch off into more specific areas of study. Thanks!

    Read the article

  • LL(8) and left-recursion

    - by Peregring-lk
    I want to understand the relation between LL/LR grammars and the left-recursion problem (for any question I know parcially the answer, but I ask them as I don't know nothing, because I am a little confused now, and prefer complete answers) I'm happy with sintetized or short and direct answers (or just links solving it unambiguously): What type of language isn't LL(8) languages? LL(K) and LL(8) have problems with left-recursion? Or only LL(k) parsers? LALR(1) parser have troubles with left or right recursion? What type of troubles? Only in terms of the LL/LALR comparision. What is better, Bison (LALR(1)) or Boost.Spirit (LL(8))? (Let's suppose other features of them are irrelevant in this question) Why GCC use a (hand-made) LL(8) parser? Only for the "handling-error" problem?

    Read the article

  • Why is Prolog associated with Natural Language Processing?

    - by kyphos
    I have recently started learning about NLP with python, and NLP seems to be based mostly on statistics/machine-learning. What does a logic programming language bring to the table with respect to NLP? Is the declarative nature of prolog used to define grammars? Is it used to define associations between words? That is, somehow mine logical relationships between words (this I imagine would be pretty hard to do)? Any examples of what prolog uniquely brings to NLP would be highly appreciated.

    Read the article

1 2 3  | Next Page >