OCaml parsing and lexing using streams - parsing

I am currently studying on ocaml lexing and parsing to create a micro compiler. My micro-compiler is meant to accept streams as input do a function and display stream(s) as output. Is there any online material that I can read up on how to do this?

You could try to read this if you're working on a compiler for a synchronous data-flow language (lot of other interesting stuff on the webpage of Marc Pouzet like this). Hoping this will help you.

Related

RPG language : How to make a loop?

I would like to learn the language RPG, How to make a loop for example?
Do know you a website that offers tutorials? I don't find nothing...
Thank you very much.
As RPG is a proprietary language from IBM you will not find many tutorials online. Your best source for RPG is the IBM Knowledge Center, https://www.ibm.com/support/knowledgecenter/en/ssw_ibm_i_73/rzasd/zzdow.htm . It comes with examples for such things as loops.
In RPG you have operation codes for such things as loops, short : opcodes. DOW = do while, DOU = do until, FOR. The aborting the iteration in a loop you have ITER and LEAVE.
And while you are just learning RPG you show starting learning free format RPG. Don't start with fixed format RPG. You can get into that later.
And if you are using pub400.com for learning RPG you can also use the free version of MiWorkplace (at miworkplace.com) for a nice and free editor. You don't have to use SEU.
There is a little RPG tutorial here, although it doesn't have anything about loops. https://www.ibm.com/support/pages/node/1108749

Does the API provide language code of the transcription?

I'm planning to transcribe a speech where the language is unknown, so I am trying to detect the language spoken automatically with multiple language codes given, however, I can't seem to find an option to actually find out which language the transcription will be in.
I've looked through the dev page of the speech-to-text api, but I can't seem to find a way to output the language code of the transcribed text.
Anyone could help me with this?
Thank you.
In general, the language code is returned with the results. For example, see the sample code here, which shows how to retrieve the language code from the results.
However, see the issue mentioned here. The language code does not always get returned when multiple languages are specified. As reported in the comments, this is an issue with the Google Speech API, an issue which reported here.

Parsing OFX or SGML in iOS

How do I parse OFX in iOS? OFX is formatted in SGML, and I can't find any good parsers to use in C or Objective-C on iOS.
Try using libofx. It depends on OpenJADE for SGML but I've gotten them both to compile and work on iOS.
There are a few challenges here:
(1) OFX 1.x documents are SGML-based, while 2.x documents are XML-based, so if you know you will only deal with 2.x documents you could probably use an XML parser.
(2) If you do have to deal with 1.x documents, you'll have some code-lifting ahead of you. SGML in general and OFX 1.x in particular do not enforce close tags for simple types. That means you'll see things like:
<INVACCTFROM>
<BROKERID>Fidelity Investments
<ACCTID>FidRoth
</INVACCTFROM>
Parsing this kind of thing will be tricky unless you provide your own schema logic, or pre-process the data to a more "valid" format. An example of the latter, while not in C/Obj-C/C++, is given on Scott Hanselman's blog.
Good resources on OFX can be found here.

How to compare a webcam image/video to a specific image/video?

I am basically just starting out in computer programming; mostly fluent in basic Java. I have an idea of creating an ASL (American Sign Language) to English, and my initial problem is how to identify hand movement from a webcam then comparing them to Signs that is already stored as an image or another video. If the problem is a bit too advanced for me then please list any major concepts that I can learn. Please and thank you.
You clearly have a challenging problem ^^. Try to explain all you need to solve your problem would be very hard, mainly because there many ways to do this. I advice you to read a nice book about image processing (Gonzalez' book is a nice choice) and the OpenCV documentation (but it is implemented in C, C++ and has Python bindings; although it's a library that implements a lot of image processing techniques). Maybe you should focus your study on feature detection, motion analysis and object tracking. As sign language uses not just hand sign (static state) but also hand moviments (dynamic state) to express something, object tracking may be a good way to describe the signs.I hope these informations help you, at least a little -^.^- Bye bye.
Look at OpenCV. They have a lot of libraries that you might find handy.
http://opencv.willowgarage.com/wiki/

Blackberry development: how to get XMLReader SAXParser

I'm looking to port my working Android XML parser to Blackberry, but the latter's Java feature set isn't as rich? I didn't want to have to write two parsers.
The following code yields "The method getXMLReader() is undefined for the type SAXParser":
SAXParserFactory spf = SAXParserFactory.newInstance();
SAXParser sp = spf.newSAXParser();
XMLReader xr = sp.getXMLReader();
Am I just out of luck here?
It's true I am trying to use org.xml.sax. I've read all the XML parsing discussions I can find out there. I wonder now if I can do this? Should I be using org.kxml2 instead because org.xml.sax makes no sense in BlackBerry land?
Thanks for any advice!
Russ
You don't need to use the getXmlReader() method.
Now that you have your SAXParser use it to parse a document or stream.
SaxParserFactory spf = SaxParerFacter.newInstance();
SAXParser parser = spf.newSAXParser();
Open your stream or file and call and assign it to a variable. Let's call ours input.
parser.parse(input, handler)
The handler file will implement all of the call backs to handle the events the parser encounters.
I found this explanation of SAX to be quite helpful.
I'll answer this though I suspect there are others who know better.
My assessment of BlackBerry is that it's very poor in its API set. So, the SAX XML parser isn't available as it is on Android. Okay, that's cool. It's older and from a "smaller" time.
Worse though, it appears very challenging even to add a third-party library to a BlackBerry application. I followed various posts out there and failed to incorporate my own "third-party" JAR convincingly into a BlackBerry project despite the collective wisdom of a number of web pages on the topic.
I was thinking then of writing my own parsing engine to replace SAXParser.parse(). How hard could it be since my expectations for it are childishly simple?
Very hard indeed since it appears that the JavaME support for java.lang.Class is impoverished as well; it doesn't support the important reflection methods such as getDeclaredMethods() for use in creating the engine (into which I naturally wanted to plug my existing XML parser-handler).
Alas, this makes me wonder just what BlackBerry apps out there are able to do? I'm probably giving this world short shrift, but a couple of days were sufficient for me to go from zero to parsing XML texts off the web on Android, so I expected a very easy time of it here too.
Please feel free to shred my answer. If you can and do, especially if you add a real one, it will doubtless greatly benefit other folk new to BlackBerry development including me later when I come back to the problem (so that I can avoid brute-force stringing through the XML stream instead of cleanly parsing it).

Resources