Google Mail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
test-reader.qi
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  1 message - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post will appear after it is approved by moderators
 
From:
To:
Cc:
Follow-up To:
Add Cc | Add Follow-up to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers that you hear
 
snorgers  
View profile   Translate to Translated (View Original)
 More options 5 Nov, 23:16
From: snorgers <stefan.ta...@spray.se>
Date: Thu, 5 Nov 2009 15:16:45 -0800 (PST)
Local: Thurs 5 Nov 2009 23:16
Subject: test-reader.qi
I've now been running same tests and made a couple of examples where
the focus have been in the Yacc part and the segment part of the code
as well as a General Streaming method.

as an example I did a parser for a toy lang. and then created a
modified list stream that
added the capabilities to let the line column and depth be kept in
sync with the cdr of a list.

I did this code,
(def cons-stat?
     [[X|L] A B C] -> true
     X             -> false)
(def null-stat X -> [= (head X) []])
(def head-stat [[X|L]|U] -> X)
(def tail-stat
  [[#\Newline|L] Col Row Dep] -> [L 0         (+ Row 1) Dep]
  [[X        |L] Col Row Dep] -> [L (+ Col 1)  Row      Dep])

And registered and made the stream come true

(cons-streamer lis cons-stat cons-stat? head-stat tail-stat null-stat)

Then there is a dynamic variable, e.g. *li* that can be used according
to
(let *li* lis Code) and the defines in the code will expand lists
acording to the lis
stream. Then I just modified the code slightly and voila the example
in test.reader.qi
worked. I got,

from evaluating

parse "
f(x) - b(a) + h(y)
g[y + w{a(1)}]
")

I got (the statistics is Col Row Depth)

[-list- [#\f] [[#\x]] [0 1 1]] [#\-] [-list- [#\b] [[#\a]] [7 1 1]] [#\
+]
 [-list- [#\h] [[#\y]] [14 1 1]]
 [-brck- [#\g]
  [[#\y] [#\+] [-curl- [#\w] [[-list- [#\a] [[#\1]] [8 2 3]]] [6 2
2]]]
  [0 2 1]]]

I will now stop this testing and concentrate to generating the qi code
to Lisp or Clojure or ...

Regards
Stefan


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google