Prolog Parser Implementation



Share on Google+Share on Google+

stephen lonergan
Prolog Parser Implementation
0 Answer(s)      4 years and 7 months ago
Posted in : Regex

Hi I am trying to implement a parser for a simple language with grammar like this.

program ::= "program" declarations "begin" statements "end"

declaration ::= "var" ident "as" type

type ::= "string" | "int"

I have the first two done, how would I write the type grammar?

program( prog( DECLS, STATS ) ) --> [ 'program' ], declarations( DECLS ), [ 'begin' ], statements( STATS ), [ 'end' ].

declaration( decl( IDENT, TYPE ) ) --> [ 'var' ], ident( IDENT ), [ 'as' ], type( TYPE ).

View Answers

Related Tutorials/Questions & Answers:
Prolog Parser Implementation
Prolog Parser Implementation  Hi I am trying to implement a parser for a simple language with grammar like this. program ::= "program" declarations "begin" statements "end" declaration ::= "var" ident "as" type type
parser - XML
parser  how to convert XML file to flat file(text file) using DOM and SAX parser
Xml Parser
Xml Parser  Hi... please tell me about What parser would you use for searching a huge XML file? Thanks
parser jquery css
parser jquery css  How to parser jquery in css
sax parser for xml
sax parser for xml  sax parser code that works with any XML i.e independent of any XML to extract data from XML
parser error xmlparseentityref no name
parser error xmlparseentityref no name  While parsing the error in my mobile application ..i'm getting the following error.. "parser error xmlparseentityref no name" and that is because of "&". I have also tried the "&
SAX Parser exception
SAX Parser exception  I am trying to validate one xml, its giving me exception as : cvc-elt. value '00' of element 'abcd' does not match the fixed {value constraint} '0'. Please help me asap
parser xml one page to another
parser xml one page to another  parser xml one page to another
write a jsp parser
write a jsp parser  I want figure out the variable used in a particular jsp and put it in a xml.I can do it manually but there are whote lot of a jsp to figure out .So can anyone can tell me a option to build a jsp parser
SAX Parser
SAX Parser       The Simple API for XML (SAX) is a serial access parser API for XML. It is used... executes, the SAX parser recognizes and responds to each XML structure taking
JavaScript XML Parser
JavaScript XML Parser    ... to access and manipulate XML document using DOM parser in javascript. XML parser... that the parser continues the script execution after loading of the document fully
SAX Parser for huge XML file
SAX Parser for huge XML file  Hi.... if the XML file is small... = SAXParserFactory.newInstance(); SAXParser parser = parserFact.newSAXParser... using dom parser in java. import org.w3c.dom.*; import org.w3c.dom.Node; import
VoIP Implementation
VoIP Implementation VoIP Implementation Tour We?re packing our... is launching the Voice on VOIP Implementation Tour 2004-one-day workshops...-telephony is essentially a non-starter.    VoIP Implementation
XML Parsing Using Sax Parser in J2ME for serverside
XML Parsing Using Sax Parser in J2ME for serverside  Hai team, i have doubt in Parsing using sax parser in serverside plz help me for xml parsing in j2me using sax parser on server side thanks in advance... regards Selva
java native implementation
java native implementation  What is java native implementation
implementation object in C
implementation object in C  how to create and implement an object in C
JAXP API using DOM Parser
JAXP API using DOM Parser         Introduction to XML Parser: In computing terms, a parser is a program that takes input in the form of sequential
filter implementation in java
filter implementation in java   How to implement filters in java?   Java - filter implementation Tutorials Filter Files in Java Response Filter Servlet Example
Bar chart implementation in PHP
Bar chart implementation in PHP  How to implements reports in bar graphs by using PHP
how to design a parser - Design concepts & design patterns
how to design a parser  sorry i am not sure in which category i have to put my question actually i have to design a LR (0) parser for a given grammar in java i am confused how to implement this i know how the parser
java interfaces implementation
different implementation classes for add() method and sub()and mul() when i trying... which are define in Maths interface. I want only addition implementation
String Class implementation in API
String Class implementation in API  Hi all, I was confused ,when am looking into java String class single argument constructor into that we are passing again String as parameter.How is it possible,any one can help me how can
Truncating issue while parsing XML with SAX Parser.
Truncating issue while parsing XML with SAX Parser.  I am Parsing one xml file and after parsing I have to enter the data into the database using... could understand was while calling the event handler of the SAX Parser i.e.
XML Parsing Using Sax Parser in J2ME
XML Parsing Using Sax Parser in J2ME  Hai team, I hope you, You should help me, I have trouble in Xml parsing... I have decoded value, what my process means to send that value to web services using Get method like
Question in Array Implementation (java) ??!
Question in Array Implementation (java) ??!  Good Morning EveryOne I have Q in Java - and if any One have the Answers please tall me ??!! Question is : 1- Create a class called ‚??PhoneEntry‚?? which can be used to store
Java implementation problem
Java implementation problem  I want to implement following in java code : Main thread 1. create three threads 2. wait for completion of stage 2.../answers/viewqa/Java-Beginners/28578-java-implementation-problem-.html
java implementation problem
java implementation problem   I want to implement following in java code : Main thread Create three threads wait for completion of stage 2 of all three threads Access all three local variable (LC0, LC1, LC2) of threads bulid
Read Complex XML using DOM/SAX Parser.
Read Complex XML using DOM/SAX Parser.  I have a XML file which is having two types of Items. I want to extract all details of a type only. My XML goes something like this <Movie> <Bollywood> <Actor> Shah Rukh
garbage collection implementation dependent java
garbage collection implementation dependent java  How a garbage collection works in Java
Amzi! Prolog + Logic Server
Amzi! Prolog + Logic Server   ..., Products and Services. Amzi! Prolog + Logic Server ? Embeddable, extendable Prolog for programmers to build high-performance rule-based